Recursive CTE for Org Hierarchy Depth
Hard
ctes
Snowflake
Meta
Google
Write a recursive CTE to find the management chain depth for each employee. The CEO has depth 0. Return name and depth, ordered by depth, then name.
Expected Output: Each employee with their level in the org hierarchy.
Tables
Hints (3 available)
SQL Editor
Output
Click "Run" to see results...