← Quiz: Recursive CTEs: all 15 questions
Quiz: Recursive CTEs · Question 11 of 15
How many rows does this CTE produce: WITH RECURSIVE t(n) AS (SELECT 10 UNION ALL SELECT n - 3 FROM t WHERE n 1) SELECT…
How many rows does this CTE produce: WITH RECURSIVE t(n) AS (SELECT 10 UNION ALL SELECT n - 3 FROM t WHERE n > 1) SELECT * FROM t?
- A.3
- B.4
- C.5
- D.It never stops
Answer & explanation
Correct answer: 4
10, 7, 4, 1 — when n is 1 the condition n > 1 fails and no new row is made.
Can you get the rest right without peeking?
Take the timed Quiz: Recursive CTEs quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →