68.Which statement is true regarding the default behavior of the ORDER BY clause?
A.In a character sort, the values are case- sensitive.
B.NULL values are not considered at all by the sort operation.
C.Only those columns that are specified in the SELECT list can be used in the ORDER BY clause.
D.Numeric values are displayed from the maximum to the minimum value if they have decimal positions.
答案:A
解析:
A:正确,字符排序应该使按照ascii进行排序的(先不考虑null),因此是区分大小写的
SQL> select * from test;
A B
---------- ----------
a A
A a
SQL> select * from test order by a;
A B
---------- ----------
A a
a A
SQL> select * from test order by b;
A B
---------- ----------
a A
A a
B:错误,默认null在排序中认为是最大,如果想让null放到最后,可以增加nulls last,如果想放到最前,
可以加nulls first
SQL> select * from test order by b;
A B
---------- ----------
a A
[
A a
C
SQL> select * from test order by b desc;
A B
---------- ----------
C
A a
[
a A
SQL> select * from test order by b desc nulls last;
A B
---------- ----------
A a
[
a A
C
SQL> select * from test order by b nulls first;
A B
---------- ----------
C
a A
[
A a
C:错误,order by 后面可以是任何东西
SQL> select 1 from dual order by 'wahaha';
1
----------
1
D:错误,如果是分数的话,显示是按照从大到小显示,这显然是不对的
A.In a character sort, the values are case- sensitive.
B.NULL values are not considered at all by the sort operation.
C.Only those columns that are specified in the SELECT list can be used in the ORDER BY clause.
D.Numeric values are displayed from the maximum to the minimum value if they have decimal positions.
答案:A
解析:
A:正确,字符排序应该使按照ascii进行排序的(先不考虑null),因此是区分大小写的
SQL> select * from test;
A B
---------- ----------
a A
A a
SQL> select * from test order by a;
A B
---------- ----------
A a
a A
SQL> select * from test order by b;
A B
---------- ----------
a A
A a
B:错误,默认null在排序中认为是最大,如果想让null放到最后,可以增加nulls last,如果想放到最前,
可以加nulls first
SQL> select * from test order by b;
A B
---------- ----------
a A
[
A a
C
SQL> select * from test order by b desc;
A B
---------- ----------
C
A a
[
a A
SQL> select * from test order by b desc nulls last;
A B
---------- ----------
A a
[
a A
C
SQL> select * from test order by b nulls first;
A B
---------- ----------
C
a A
[
A a
C:错误,order by 后面可以是任何东西
SQL> select 1 from dual order by 'wahaha';
1
----------
1
D:错误,如果是分数的话,显示是按照从大到小显示,这显然是不对的