SQL Practice Logo

SQLPractice Online

Scenario SQL Question

Recursive CTE for Organization Hierarchy

Build mastery in Ctes Window with this scenario-based SQL challenge and live execution support.

Problem Statement

Create a recursive CTE to build the complete organizational hierarchy. Show employee name, their level in the organization, the full management path from CEO to employee, and total employees in their reporting chain (including sub-reports).

Relevant Tables

employees