Query to find manager of employee in sql

We have Employees Table.

Write a SQL query to display employee name along with Manager name.


To achieve this we have to use self join

SELECT a.employee_id,a.first_name,b.employee_id manager_id,b.first_name manager
FROM employees a
JOIN employees b
ON a.manager_id=b.employee_id;

Output:

Leave a Reply

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