🎙 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 4 of 15

What does this query return? (code)

What does this query return?

WITH RECURSIVE t(n) AS (SELECT 1 UNION ALL SELECT n + 1 FROM t WHERE n < 4)
SELECT SUM(n) FROM t;
  1. A.4
  2. B.10
  3. C.15
  4. D.6
Answer & explanation

Correct answer: 10

The rows are 1, 2, 3, 4, and their sum is 10.

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 →