ITPub博客

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

047-094

原创 Linux操作系统 作者:jbymy2000 时间:2012-03-18 14:30:06 0 删除 编辑
94. View the Exhibit and examine the description of the EMPLOYEES and
DEPARTMENTS tables.You want to display the LAST_NAME for the employees,
LAST_NAME for the manager of the employees,and the DEPARTMENT_NAME for the
employees having 100 as MANAGER_ID. The following SQL
statement was written:
SELECT m.last_name "Manager", e.last_name "Employee", department_name
"Department" FROM employees m JOIN employees e
ON (m.employee_id = e.manager_id)
WHERE e.manager_id=100 JOIN departments d
ON (e.department_id = d.department_id);
Which statement is true regarding the output of this SQL statement?
A. The statement would provide the desired results.
B. The statement would not execute because the ON clause is written twice.
C. The statement would not execute because the WHERE clause is wrongly placed.
D. The statement would not execute because the self join uses the ON clause
instead of the USING clause.
Answer: C
SQL> select m.ename "Man",e.ename "Emp"
2 from emp m join emp e
3 on m.emp_no=e.mgr_no
4 where m.mgr_no=2 join dept d
5 on(m.emp_no=d.deptid);
第 4 行出现错误:
ORA-00933: SQL 命令未正确结束
SQL> select m.ename "Man",e.ename "Emp"
2 from emp m join emp e
3 on m.emp_no=e.mgr_no
4 join dept d
5 on(m.emp_no=d.deptid)
6 where m.mgr_no=2 ;
Man Emp
dd tt

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

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

注册时间:2012-01-10

  • 博文量
    416
  • 访问量
    203340