Q: 134 Click the Exhibit button and examine the data in the EMPLOYEES and
DEPARTMENTS tables.
You want to retrieve all employees' last names, along with their managers' last names and their
department names. Which query would you use?
A. SELECT last_name, manager_id, department_name
FROM employees e
FULL OUTER JOIN departments d ON (e.department_id = d.department_id);
B. SELECT e.last_name, m.last_name, department_name
FROM employees e
LEFT OUTER JOIN employees m on ( e.manager_id = m.employee_id)
LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);
C. SELECT e.last_name, m.last_name, department_name
FROM employees e
RIGHT OUTER JOIN employees m on ( e.manager_id = m.employee_id)
LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);
D. SELECT e.last_name, m.last_name, department_name
FROM employees e
LEFT OUTER JOIN employees m on ( e.manager_id = m.employee_id)
RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);
Answer: B
问下题目意思是啥呢?along with 在灵格斯里面查到是与...一起,我理解成inner join的概念,但是发现跟答案不符合,这是为什么?
------解决方案--------------------------------------------------------
提取员工的last names,他们经理的last names和他们所属于的部门
LEFT OUTER JOIN相当于LEFT JOIN,比如e.manager_id = m.employee_id,左边的表的数据可以显示并且允许右边不存在匹配数据
------解决方案--------------------------------------------------------
选B啦...题目意思就是要所有的employee的名字,以及他们的manager和department的名字...
所以用employee表做主表,left join 其它两个表,employee的名字肯定能出来,
到于能不能找到manager和department的名字,无所谓啦.
------解决方案--------------------------------------------------------
along with不属于sql功能语句范畴,只是一句英语,表示与什么一起同时显示出来,跟[唯一性关联]没关系
------解决方案--------------------------------------------------------
along with
google 金山翻译:除某物以外
------解决方案--------------------------------------------------------
重点在 all employees' last names
along with 对应到 join 就可以了。