The CONNECT BY clause determines the parent-child relationship of rows when performing a hierarchical query. The syntax of the CONNECT BY clause is as follows:

CONNECT BY { PRIOR parent_expr = child_expr |
 child_expr = PRIOR parent_expr }

parent_expr is evaluated on a candidate parent row. If parent_expr = child_expr results in TRUE for a row returned by the FROM clause, this row is considered a child of the parent.

The following optional clauses can be specified in conjunction with the CONNECT BY clause:

START WITH start_expression

The rows returned by the FROM clause on which start_expression evaluates to TRUE become the root nodes of the hierarchy.

ORDER SIBLINGS BY expression [ ASC | DESC ] [, ...]

Sibling rows of the hierarchy are ordered by expression in the result set.

Note PolarDB-O does not support the use of AND or other operators in the CONNECT BY clause.