View the Exhibit and examine the structure of the EMPLOYEES table.
You want to display all employees and their managers having 100 as the MANAGER_ID. You want the output in two columns: the first column would have the LAST_NAME of the managers and the second column would have LAST_NAME of the employees.
Which SQL statement would you execute?
A.
SELECT m.last_name “Manager”, e.last_name “Employee” FROM employees m JOIN employees e
ON m.employee_id = e.manager_id
WHERE m.manager_id=100;
B.
SELECT m.last_name “Manager”, e.last_name “Employee” FROM employees m JOIN employees e
ON m.employee_id = e.manager_id
WHERE e.manager_id=100;
C.
SELECT m.last_name “Manager”, e.last_name “Employee” FROM employees m JOIN employees e
ON e.employee_id = m.manager_id
WHERE m.manager_id=100;
D.
SELECT m.last_name “Manager”, e.last_name “Employee” FROM employees m JOIN employees e
WHERE m.employee_id = e.manager_id AND e.manager_id=100;
y not A?
What is the difference output between A, B, and C? Because they all return same results
I think answer C would also work and return the same result as answer B.
Tried different combination of the queries. Found no difference in results, between B and C.
WHERE m.manager_id <== query out the manager_id from the Manager table.
WHERE e.manager_id <== query out the manager_id from the Employee table.
Objective: display ALL employees and their managers having manager = 100
note:”their managerS”, answer should be A
B is correct.
A lists employees managed by 100 who are managers themselves, and lists their employees.
C lists last_name of the managers as second column, instead of first
D wrong syntax