Self Join: Employees and Their Managers
Hard
joins
Google
Meta
LinkedIn
The employees table has a manager_id column referencing another employee's emp_id. Use a self join to return each employee alongside their manager's name. Employees with no manager (the CEO) should still appear with NULL for manager_name.
Expected Output
| emp_name | manager_name |
|---|---|
| Alice | NULL |
| Bob | Alice |
| Carol | Alice |
| Dave | Bob |
| Eve | Bob |
Tables
Hints (3 available)
SQL Editor
Output
Click "Run" to see results...