Advanced
SQL
Q84 / 100
How does a recursive CTE (Common Table Expression) work, e.g. for traversing a hierarchy?
Correct! Well done.
Incorrect.
The correct answer is B) It consists of an "anchor" member (base case) UNIONed with a "recursive" member that references the CTE itself, repeatedly executing until the recursive member returns no new rows
B
Correct Answer
It consists of an "anchor" member (base case) UNIONed with a "recursive" member that references the CTE itself, repeatedly executing until the recursive member returns no new rows
Explanation
A recursive CTE defines a base case and a recursive case combined with UNION (or UNION ALL); the database repeatedly evaluates the recursive part against the previous iteration's results until no new rows are produced, commonly used for hierarchical/tree data.
Progress
84/100