SELECT E.EMPLOYEE_ID,E.LAST_NAME,E.MANAGER_ID FROM HR.EMPLOYEES E CONNECT BY PRIOR E.EMPLOYEE_ID = E.MANAGER_ID;
The CONNECT BY clause to define the relationship between employees and managers.
CONNECT BY