Concept of hierarchical query in Oracle syntax format: select [level], column, expr... from table [where condition] start with condition connect by [prior column1 = column2 | column1 = prior column2]; hierarchical queries are identified by the start with and connect by clauses: 1. The level keyword is optional, indicating the level, 1 indicating the root, 2 indicating the root child, and other identical rules. 2. A table can be followed by a From statement, but a view can only be a table. 3. The Where condition limits the rows returned by the query, but does not affect the hierarchy. It truncates the node, but the lower child of the truncated node is not affected. 4. Start with indicates the Start Node. This clause is required for a real hierarchical relationship, but not required. 5. connect by prior specifies the parent-child relationship. The prior location does not have to be after connect by. This is also required for a real hierarchy. Example: in a self-join, if the data volume is large, the Cartesian set may occur. SQL> -- the same table is treated as multiple tables using the table alias> select e. ename | 'The Boss is '| B. ename 2 from emp e, emp B 3 where e. mgr = B. empno; Result: In order to avoid this situation, the hierarchical query in Oracle is used. below, I will show an example of hierarchical query in the tree graph: SQL> -- execute hierarchical query SQL> select level, empno, ename, mgr 2 from emp 3 connect by prior empno = mgr 4 start with mgr is null 5 order by 1; Result: