Friday, April 18, 2014

Order By clause on Alphanumeric data



SQL> select * from student;

data
----------------------
1
a
ssa
b
11
3
99

7 rows selected.

SQL> select * from student order by data desc;

data
----------------------
ssa
b
a
99
3
11
1

7 rows selected.

Note: Comparison starts with only first character of each row of a column
(for alphabets it takes ASCII values eg: for a 65,b 66,.....)
         



No comments:

Post a Comment