SnowPro Core Certification — Question 485
Which SQL commands should be used to write a recursive query if the number of levels is unknown? (Choose two.)
Answer options
- A. CONNECT BY
- B. LISTAGG
- C. MATCH RECOGNIZE
- D. QUALIFY
- E. WITH
Correct answer: A, E
Explanation
The correct answers, A (CONNECT BY) and E (WITH), are used for recursive queries in SQL. CONNECT BY allows the establishment of hierarchical queries, while WITH enables the definition of common table expressions (CTEs) that can reference themselves, facilitating recursion. The other options, LISTAGG, MATCH RECOGNIZE, and QUALIFY, do not support recursive querying.