🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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;
  1. A.8
  2. B.32
  3. C.2
  4. 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 →