Oracle Key Overview (1: Basic SELECT statement)

xiaoxiao2021-03-06  42

Summary: Contact Oracle is almost two years, at the end of the year, now I want to calm down, so I have summarized the test below. 1. Test Environment: A: OS: Microsoft Windows XP [Version 5.1.2600] DB: Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production B: OS: SunOS 5.9 [Solaris 9] DB: Oracle10G Enterprise Edition Release 10.1.0.3 - 1 of Production: Basic SELECT Statement Outline: 1.Char and VARCHAR2 2.NUMBER 4. Sizeless Distance (Single Number, Lisu Name) 5. About NULL (Compare, Sorting Location) 6. Essential Character (Escape Character) 8 The default length is 1, VARCHAR2 must indicate the length of SQL> Create TABLESPACE USERS; TABLESPACE USERS; table is created SQL> DESC TEST; Name Type Nullable Default Comments ---- ------------ -------------------- x char (1) y y varchar2 ( 10) Y B. Tail space comparison, for char type, 'a' = 'a', for varchar2 type, 'b' <'b' sql> alter table test modify (x char (10)); Table is changed SQL > INSERT INTO TEST VALUES ('A', 'B'); 1 line has been inserted into SQL> SELECT * from test where x = 'a'; x y ---------- ------ ---- A b SQL> SELECT * from test where y = 'b'; x y ------------------ SQL> Select * from test where y> 'b'; x y ---------- -------- A b --------------- -------------------------------------------------- -------------------------------------------------- ----- --------------------------------------------- -------------------------------------------------- ------------------------ 2.Number 4. Sizeless write distinction (single number, column name) keyword, column name, and data table name Write, only the data included in single quotes is case sensitive. To use spaces or case sensitive in the alias, you must use double quotes 5. Sort NULL (compare, sort position) Null value: By default, NULL row At a high position, NULLS FIRST or NULLS LAST can be used to change.

Select * from test order by y nulls first; related null (comparison), see: 6. escape character (escape character) SQL> INSERT INTO TEST VALUES ('XYZ% A_D', ''); SQL> SELECT * FROM TEST WHERE X Like 'XYZ /% A / _%' Escape '/'; x y ---------- -------- XYZ% A_D 8. About DUAL table authority explanation: Http://asktom.racle.com/pls/ask/f?p=4950:8:18211305788624471845::NO ::f4950_p8_displayid ,F4950_p8_criteria:1562813956388

转载请注明原文地址:https://www.9cbs.com/read-76528.html

New Post(0)