(156)Evaluate the following SQL statement:
SELECT cust_id, cust_last_name "Last Name" FROM customers WHERE country_id = 10 UNION SELECT cust_id CUST_NO, cust_last_name FROM customers WHERE country_id = 30; |
Which ORDER BY clauses are valid for the above query? (Choose all that apply.)
A. ORDER BY 2,1
B. ORDER BY CUST_NO
C. ORDER BY 2,cust_id
D. ORDER BY "CUST_NO"
E. ORDER BY "Last Name"
答案:(A、C、E)
解析:
ORDER BY子句中列的序号和列名可以混合使用
B(X),最后的结果集中不会有CUST_NO列,因为它与第一个查询的对应的列名不同,会使用第一个查询中的列名
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/17013648/viewspace-1171407/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/17013648/viewspace-1171407/