▸_sqlgym

85. Count Events Per Month

MediumDates & TimestrftimeGROUP BY month

To aggregate by calendar month you GROUP BY a month key built with strftime('%Y-%m', date), which collapses every date in the same month to one bucket like '2024-03'.

Task: return ym (the '%Y-%m' month key) and cnt (the number of events in that month). Include only months that actually have events. Order by ym.

Output columns, in order: ym, cnt.

Tables
Loading schema…
Expected outputrows must come back in this order
Computing expected output…

This is the result for the example data above. On Submit your query is graded against this example plus 4 hidden edge cases 5test cases in all. A sloppy query that only fits the example won't pass.

SQL
⌘/Ctrl+↵ run · ⇧⌘/Ctrl+↵ submit
Run a query to see its output here.