Winter Sign-Ups Week by Week
hardQuestion 48Use a recursive CTE named weeks to generate every Monday from 2025-12-01 to 2026-01-12 (seven dates one week apart, stepping with date(…, '+7 days')). Then LEFT JOIN enrollments so each week counts the rows whose enrolled_on falls on or after that Monday and before the next one. Return week_start and signups, sorted by week_start; the three holiday weeks in the middle must show 0.
Expected result
+------------+---------+ | week_start | signups | +------------+---------+ | 2025-12-01 | 15 | | 2025-12-08 | 13 | | 2025-12-15 | 0 | | 2025-12-22 | 0 | | 2025-12-29 | 0 | | 2026-01-05 | 4 | | 2026-01-12 | 2 | +------------+---------+ 7 rows
Hints4 available
Sign in to use hintsTopics
CTEs
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)
Results
Run your SQL to see every statement's output here, then how it compares with the expected answer.
Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns, or open the database browser under the question.