Your question is SQL: Manager of Manager. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Walmart Global Tech maintains an employee hierarchy for organizational reporting. The reporting team needs to display each employee's direct manager and second-level manager, including employees whose hierarchy is incomplete.
Write a PostgreSQL query that returns every employee, their direct manager, and their manager's manager.
employees table to resolve both management levels.NULL for unavailable names.employee_id ascending.| Column | Type | Description |
|---|---|---|
| employee_idPK | INT | Unique employee identifier |
| manager_id | INT | Self-referencing employee ID for the direct manager |
| employee_name | VARCHAR(100) | Employee's full name |