Loading problem...
A company keeps reporting-line data in a single relational table:
Employees(employee_id, employee_name, manager_id)
Column details:
Business rules:
Task: Return the employee_id of every employee who reports to the company head (employee_id = 1), either directly or indirectly.
Output requirements:
Supported submission environments:
employees:
| employee_id | employee_name | manager_id |
|-------------|---------------|------------|
| 1 | CEO | 1 |
| 2 | Nora | 1 |
| 3 | Omar | 3 |
| 4 | Priya | 2 |
| 5 | Quentin | 4 |
| 6 | Rina | 6 |
| 7 | Sam | 3 |[
{"employee_id":2},
{"employee_id":4},
{"employee_id":5}
]Employees 2, 4, and 5 are in the reporting chain that reaches employee 1. Employees 3, 6, and 7 are outside that chain.
employees:
| employee_id | employee_name | manager_id |
|-------------|---------------|------------|
| 1 | CEO | 1 |
| 9 | Tina | 9 |
| 10 | Uma | 9 |[]No employee has a manager chain that reaches employee 1.
employees:
| employee_id | employee_name | manager_id |
|-------------|---------------|------------|
| 1 | CEO | 1 |
| 11 | Vik | 1 |
| 12 | Wen | 11 |
| 13 | Xena | 12 |
| 14 | Yara | 14 |[
{"employee_id":11},
{"employee_id":12},
{"employee_id":13}
]Employees 11, 12, and 13 connect to employee 1 through a direct/indirect chain. Employee 14 is self-managed and does not report to 1.
Constraints