D8LooPFocus modeCODE WORKSPACE
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
| event_id | event_time |
|---|---|
| 1 | 2026-01-01 03:30:00 |
| 2 | 2026-01-01 04:10:00 |
| 3 | 2026-01-01 22:15:00 |
| 4 | 2026-01-02 00:30:00 |
| 5 | 2026-01-02 05:00:00 |
| 6 | 2026-01-03 18:00:00 |
Expected output
| event_day | events |
|---|---|
| 2026-01-01 | 3 |
| 2026-01-02 | 2 |
| 2026-01-03 | 1 |
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.
Run the SQL query to inspect preview rows.