Learning Self Join!




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

Popular posts from this blog

Let's extract STRING!

Let's learn Left Outer Join!

Let's learn Cross Join!