Learning Self Join!
Usage:
HR manager to data analyst: Bring me the employee ids along with the name of manager managing that employee. Data analyst runs below query to fetch the required data.
SELECT E.EMPLOYEE_ID, M.EMPLOYEE_ID AS MANAGER_ID, M.FIRST_NAME, M.LAST_NAME FROM EMPLOYEES E, EMPLOYEES M
WHERE E.MANAGER_ID= M.EMPLOYEE_ID;


Comments
Post a Comment