Which SQL query gets the required output?

Examine the structure of the EMPLOYEES table:

There is a parent/child relationship between EMPLOYEE_ID and MANAGER_ID.
You want to display the name, joining date, and manager for all employees. Newly hired employees are yet to be assigned a department or a manager. For them, ‘No Manager’ should be displayed in the MANAGER column.
Which SQL query gets the required output?
A. SELECT e.last_name, e.hire_date, NVL(m.last_name, ‘No Manager’) Manager
FROM employees e JOIN employees m
ON (e.manager_id = m.employee_id);
B. SELECT e.last_name, e.hire_date, NVL(m.last_name, ‘No Manager’) Manager
FROM employees e LEFT OUTER JOIN employees m
ON (e.manager_id = m.employee_id);
C. SELECT e.last_name, e.hire_date, NVL(m.last_name, ‘No Manager’) Manager
FROM employees e RIGHT OUTER JOIN employees m
ON (e.manager_id = m.employee_id);
D. SELECT e.last_name, e.hire_date, NVL(m.last_name, ‘No Manager’) Manager FROM employees e NATURAL JOIN employees m
ON (e.manager_id = m.employee_id).

Download Printable PDF. VALID exam to help you PASS.

One thought on “Which SQL query gets the required output?

Leave a Reply

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


The reCAPTCHA verification period has expired. Please reload the page.