Back to problems

Find All Reports Under a Manager (n-level) and Return Hierarchy Path

SQL · Tesla · Hard

Problem You are given an organization table with the columns employee_id, manager_id, and name: Write a SQL query that returns every employee whose reporting chain leads to manager_id = 1, including both employees who report directly to manager 1 and those found at deeper levels. Requirements Include the complete reporting path for each returned employee. Return these columns: employee_id, manager_id, name, level, hierarchy_path. level is the employee's distance below…

Checking your access…