Exercise 5 of 17
Submissions by ISO week
Fixed training server
Summarize sequences collected in 2024 by ISO calendar week. Return the ISO week and sequence count, ordered chronologically.
The output should have this shape:
week | count
-------- | -----
2024-W01 | 1234
2024-W02 | 987Write a query and run it. The result is compared with the reference answer without considering row order.
Loading query editor…
Loading query editor…
Explanation
Filter the table to dates in 2024. Use map with isoWeek to add the ISO week, then use groupBy to count the sequences for each week. Order the rows by week — the ISO week strings sort chronologically.
Reference answer
default
.filter(date.between('2024-01-01'::date, '2024-12-31'::date))
.map({week:=date.isoWeek()})
.groupBy({count:=count()}, {week})
.orderBy({week})