Data Transformation and Data Modeling1 / 5
An analyst uses CONNECT BY to query an employee hierarchy table. Which pseudo-column indicates the depth of each node relative to the root in the traversal?
CorrectIncorrect
Alex
LEVEL is the correct pseudo-column for depth in CONNECT BY hierarchical queries. It returns 1 for root nodes and increments by 1 for each deeper level. Example: SELECT employee_id, LEVEL FROM employees START WITH manager_id IS NULL CONNECT BY PRIOR employee_id = manager_id. Distractors: DEPTH(), SYS_TREE_DEPTH, and CONNECT_BY_DEPTH are fabricated—none exist in Snowflake. Other valid CONNECT BY pseudo-columns include CONNECT_BY_ROOT (root row value) and SYS_CONNECT_BY_PATH (full path string), but only LEVEL indicates depth. Ref: docs.snowflake.com/en/sql-reference/constructs/connect-by
Sourcedocs.snowflake.com
Follow-up answers are available in the app. Create a free account — no credit card required.
Question 1 of 5
Create a free account