Write a postgre sql query to make a join with two tables employees and itself to find the employee id, last_name as Employee along with their manager_id and last name as Manager
Write a postgre sql query to make a join with two tables employees and itself to find the employee id, last_name as Employee along with their manager_id and last name as Manager
SELECT W1.employee_id as "Emp_id" , W1.last_name AS "Employee",
W2.employee_id AS "Manager ID", W2.last_name AS "Manager"
FROM employees W1 JOIN employees W2
ON W1.manager_id= W2.employee_id;
Code:
Sample table: employees
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer