Managers and Employees:
Given the following table, write a SQL statement that determines level of depth each employee has from the president
Expected Output:
Source Table:
Output:
Script:
SELECT
employee_id,
manager_id,
job_id,
salary,
level - 1 depth
FROM
hr.employees
START WITH
manager_id IS NULL
CONNECT BY
PRIOR employee_id = manager_id
order by 1;
No comments:
Post a Comment