Which query would you use?

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?

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 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);

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 last_name, manager_id, department_name
FROM employees e
JOIN departments d ON (e.department_id = d.department_id) ;

D.
SELECT last_name, manager_id, department_name
FROM employees e
FULL OUTER JOIN departments d ON (e.department_id = d.department_id);

E.
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);

F.
SELECT e.last_name, m.last_name, department_name
FROM employees e
RIGHT OUTER JOIN employees m on ( e.manager_id = m.employee_id)
RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);



Leave a Reply 0

Your email address will not be published. Required fields are marked *