Org chart depth
For every employee (current or not), return:
level, how far down the org chart they are. Someone with no manager is level 1, their direct reports are level 2, and so on.reports_total, how many people sit anywhere below them in the chart (direct reports, their reports, and so on all the way down). Count everyone, current or not.
You can assume there are no loops in the chart, and every manager_id points at an existing employee.
output columns
emp_idnamelevelreports_totaluses
ctrl + enter to run on the sample data · ctrl + shift + enter to submit
run your query to see the output here. Submit checks it against the sample data, hidden test cases, random data and a large dataset.