Defining the parent/child relationship v16
To determine the children for any given row:
Evaluate
parent_expr
on the given row.Evaluate
child_expr
on any other row resulting from the evaluation oftable_expression
.If
parent_expr = child_expr
, then this row is a child node of the given parent row.Repeat the process for all remaining rows in
table_expression
. All rows that satisfy the equation in step 3 are the children nodes of the given parent row.
Note
The evaluation process to determine if a row is a child node occurs on every row returned by table_expression
before the WHERE
clause is applied to table_expression
.
Iteratively repeating this process, treating each child node found in the prior steps as a parent, constructs an inverted tree of nodes. The process is complete when the final set of child nodes has no children of its own. These are the leaf nodes.
A SELECT
command that includes a CONNECT BY
clause typically includes the START WITH
clause. The START WITH
clause determines the rows that are to be the root nodes, that is, the rows that are the initial parent nodes upon which to apply the algorithm.