#833

Tag every employee with their org depth

Compute the depth of every employee in the org hierarchy: the CEO is at depth 1, their direct reports at depth 2, their reports' reports at depth 3, and so on down the reporting tree. Show the employee's id, name, and depth in the hierarchy. Sort by depth, ties broken by id.

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.

idnamedepth
1CEO1
2CTO2
3CFO2

Your query result will appear here