68.Which statement is true regarding the default behavior of the ORDER BY clause?

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:错误,如果是分数的话,显示是按照从大到小显示,这显然是不对的
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值