CODE WORKSPACE

Daily events by event time

Return event_day and events (the count of events) grouped by the calendar day of event_time. Order by event_day.

GROUP BY date(event_time) with COUNT(*) AS events, then ORDER BY event_day.

Sample input

eventsBucket by event_time (not ingested_at). Three events on 01-01, two on 01-02, one on 01-03.
event_idevent_time
12026-01-01 03:30:00
22026-01-01 04:10:00
32026-01-01 22:15:00
42026-01-02 00:30:00
52026-01-02 05:00:00
62026-01-03 18:00:00

Expected output

Expected outputEvent count per calendar day of event_time.
event_dayevents
2026-01-013
2026-01-022
2026-01-031

Constraints

Bucket with date(event_time) — use event_time, not ingested_at. GROUP BY date(event_time) with COUNT(*) AS events. Order by event_day.

Expected skills

Timestamp bucketing and choosing the timestamp that matches the question.

SQL
Loading...

AI evaluation

Run the SQL query to inspect preview rows.