LinkedIn's org-chart feature needs to list everyone in a manager's downstream organization. For the manager named `Dana Cole`, return all direct and indirect reports (reports of reports, and so on), but not Dana herself. For each person return `member_id`, `member_name` and `depth`, where direct reports have depth 1, their reports depth 2, and so on. Order the results by `depth` ascending, then `member_id` ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.