作业帮 > 英语 > 作业

oracle OCP 中一道关于表的连接的题.不知哪位大哥不吝赐教.

来源:学生作业帮 编辑:大师作文网作业帮 分类:英语作业 时间:2024/09/28 11:21:16
oracle OCP 中一道关于表的连接的题.不知哪位大哥不吝赐教.
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
hh
oracle OCP 中一道关于表的连接的题.不知哪位大哥不吝赐教.
where 子句应当放到最后.
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)
JOIN departments d
ON (e.department_id = d.department_id)
WHERE e.manager_id=100;
再问: 在这类连接中,where字句都是放在最后的么
再答: 如果子句是对整体而言的,就要放到后面。
再问: 懂了。能再帮我看一道题么。。见问题补充,选项D为什么是对的?
再答: 补充到哪里了?我看不到呢。