STARTING
Example
Section titled “Example”STARTING WITH emp.employee_id = 100CONNECT BY PRIOR emp.employee_id = emp.manager_id;Output
Section titled “Output”100 | Steven | King | NULL101 | Neena | Kochhar| 100108 | Nancy | Greenberg | 101109 | Daniel | Faviet | 108Explanation
Section titled “Explanation”The STARTING WITH clause in Oracle SQL is used for hierarchal querying. In this example, the query identifies a hierarchy of employees where employee relation starts ‘FROM’ employee_id 100 and moves ‘TO’ the corresponding manager_id. Result set is generated in a tree structure with ‘Starting’ being the root.