← Quiz: Recursive CTEs: all 15 questions
Quiz: Recursive CTEs · Question 3 of 15
What does this query return? (code)
What does this query return?
WITH RECURSIVE t(n) AS (SELECT 2 UNION ALL SELECT n * 2 FROM t WHERE n < 16)
SELECT MAX(n) FROM t;
- A.8
- B.32
- C.2
- D.16
Answer & explanation
Correct answer: 16
The rows are 2, 4, 8, 16. When n is 16 the condition n < 16 fails, so no 32 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 →