← 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;
- A.4
- B.10
- C.15
- 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 →