ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 047-111

047-111

原创 Linux操作系统 作者:jbymy2000 时间:2012-03-19 09:13:05 0 删除 编辑
111. View the Exhibit and examine the data in the EMPLOYEES tables.
Evaluate the following SQL statement:
SELECT employee_id, department_id
FROM employees WHERE department_id= 50 ORDER BY department_id
UNION
SELECT employee_id, department_id FROM employees WHERE department_id= 90
UNION
SELECT employee_id, department_id FROM employees WHERE department_id= 10;
What would be the outcome of the above SQL statement?
A. The statement would execute successfully and display all the rows in the
ascending order of DEPARTMENT_ID.
B. The statement would execute successfully but it will ignore the ORDER BY
clause and display the rows in random order.
C. The statement would not execute because the positional notation instead
of the column name should be used with the ORDER BY clause.
D. The statement would not execute because the ORDER BY clause should appear
only at the end of the SQL statement, that is, in the last SELECT statement.
Answer: D
1: SQL> select emp_no,ename from emp
where emp_no=1
order by emp_no
union
select emp_no,ename from emp
where emp_no=3;
第 4 行出现错误:
ORA-00933: SQL 命令未正确结束
2: SQL> select emp_no,ename from emp
where emp_no=1
union
select emp_no,ename from emp
where emp_no=3
order by emp_no;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/11312660/viewspace-718919/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 047-109
下一篇: 047-112
请登录后发表评论 登录
全部评论

注册时间:2012-01-10

  • 博文量
    416
  • 访问量
    203413