Sign in to run and submit your work
Reading is open to everyone. Running code and saving drafts need an account so your work is yours and comes back on your next visit.
or
CODE WORKSPACE
Return pacific_event_day and active_users using datetime(event_time, '-8 hours').
Result columns · in this order
pacific_event_dayactive_usersHow to approach it
Shift the timestamp before taking date().
Sample input
| event_id | user_id | event_time |
|---|---|---|
| 1 | 1 | 2026-01-01 03:30:00 |
| 2 | 1 | 2026-01-01 04:10:00 |
| 3 | 2 | 2026-01-01 22:15:00 |
| 4 | 2 | 2026-01-02 00:30:00 |
| 5 | 3 | 2026-01-02 05:00:00 |
| 6 | 1 | 2026-01-03 18:00:00 |
6 rows — all rows shown.
Expected output
| pacific_event_day | active_users |
|---|---|
| 2025-12-31 | 1 |
| 2026-01-01 | 2 |
| 2026-01-03 | 1 |
3 rows — all rows shown.
Constraints
Use COUNT(DISTINCT user_id) and group by the shifted date.
Expected skills
Timezone-style bucketing and distinct user counts.
Submit for review to find out what your query gets right, what it gets wrong, and how it compares with the best working query for this exercise.
This scenario runs a full workspace — editor, canvas and results side by side. It needs a laptop or desktop to be usable. Open this page on a bigger screen to start building.