OCP-1Z0-051-2015-7题
来源:互联网 发布:c语言大小写转换用str 编辑:程序博客网 时间:2024/05/18 01:44
QUESTION NO: 7
Evaluate these two SQL statements:
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC;
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC;
What is true about them?
A. The two statements produce identical results.
B. The second statement returns a syntax error.
C. There is no need to specify DESC because the results are sorted in descending order by
default.
D. The two statements can be made to produce identical results by adding a column alias for the
salary column in the second SQL statement.
Answer: A
Explanation: Explanation: the two statement produce identical results as ORDER BY 2 will take
the second column as sorting column.
Incorrect answer:
Bthere is no syntax error
Cresult are sorted in ascending order by default
DORDER BY 2 will take the second column as sorting column.
Evaluate these two SQL statements:
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY salary DESC;
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC;
What is true about them?
A. The two statements produce identical results.
B. The second statement returns a syntax error.
C. There is no need to specify DESC because the results are sorted in descending order by
default.
D. The two statements can be made to produce identical results by adding a column alias for the
salary column in the second SQL statement.
Answer: A
Explanation: Explanation: the two statement produce identical results as ORDER BY 2 will take
the second column as sorting column.
Incorrect answer:
Bthere is no syntax error
Cresult are sorted in ascending order by default
DORDER BY 2 will take the second column as sorting column.
Refer: Introduction to Oracle9i: SQL, Oracle University Study Guide, 2-22
试验结果两个语句都能执行。B错 A对,且两个语句执行结果都是一样的(identical results)
因为order by salary desc 等于 order by 2 desc ,salary 是第二个元素。
但是数字不可以使用0,也不可以查处查询的列。
0 0
- OCP-1Z0-051-2015-7题
- OCP-1Z0-051-2015-1题
- OCP-1Z0-051-2015-2题
- OCP-1Z0-051-2015-3题
- OCP-1Z0-051-2015-4题
- OCP-1Z0-051-2015-5题
- OCP-1Z0-051-2015-6题
- OCP-1Z0-051-2015-8题
- OCP-1Z0-051-2015-9题
- OCP-1Z0-051-2015-10题
- OCP-1Z0-051-2015-11题
- OCP-1Z0-051-2015-12题
- OCP-1Z0-051-2015-13题
- OCP-1Z0-051-2015-14题
- OCP-1Z0-051-2015-15题
- OCP-1Z0-051-2015-16题
- OCP-1Z0-051-2015-17题
- OCP-1Z0-051-2015-18题
- Latex 字母上面加符号 波浪线 横线 角号等
- Codeforces Round #144 (Div. 1) B dp
- Android之Adapter用法总结
- MATLAB双目标定与OpenCV计算矫正参数矩阵
- 黑马程序员——Java基础---内部类
- OCP-1Z0-051-2015-7题
- 3.12
- 跑跑卡丁车解题报告
- UnixC内存管理那些事儿(下)
- Zookeeper应用场景
- 1_版本控制
- 3-11
- HttpClient使用详解
- Django下载文件时,中文文件名问题