oracle|select| statement
Summary: Contact Oracle for nearly two years, coincides with the end of the year, now want to calm down to sum up, and then out of the following test summary.
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-production
One: Basic SELECT statement
Outline:
1.CHAR and VARCHAR2
2.Number
4. Case sensitive (single quotes, column aliases)
5. About null (comparison, sort position)
6. Escape character (escape character)
7.Order by phrase can you use Alias, Group by phrase, or column aliases?
8. Relevant dual table
1.CHAR and VARCHAR2
A.char default length is 1, VARCHAR2 must indicate length
Sql> CREATE TABLE Test (x char,y varchar2) tablespace users;
Table is created
sql> desc test;
Name Type Nullable Default Comments
---- ------------ -------- ------- --------
X CHAR (1) Y
Y VARCHAR2 (Ten) Y
B. Trailing space comparisons, 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 lines inserted
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 ';
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.