Listens by hour of day
The task
The music team plans playlist drops around when people listen. Look at May 2025 (from 2025-05-01 00:00:00 up to, not including, 2025-06-01 00:00:00).
A listen is a play with seconds_played of at least 30. Exactly 30 counts. Hours are UTC hours of played_at, 0 to 23.
Return exactly 24 rows, one per hour, including hours with no listens:
hour_of_day: 0 to 23listens: the number of listens that started in that hour (0 if none)share_pct: that hour's share of all May listens, as a percentage rounded to 1 decimal place
Sort by hour_of_day.
Expected output
hour_of_daylistensshare_pct- Sorted by hour_of_day ascending.
- Numbers rounded to 1 decimal place.
- Checked on the sample and on 2 hidden datasets. How grading works
Tables Music streaming service · click a name to insert it
listeners180 rows in the sample
One row per listener account. Key: listener_id.
| int | Unique id. | |
| date | Day they joined. | |
| text | Two-letter country code. | |
| text | free, premium or family. |
artists30 rows in the sample
One row per artist. Key: artist_id.
| int | Unique id. | |
| text | Name. | |
| text | pop, rock, hip-hop, electronic, jazz or folk. |
tracks116 rows in the sample
One row per track. Key: track_id.
| int | Unique id. | |
| text | Track title. | |
| int | Main artist. | |
| int | Length. | |
| date | Release day. |
plays6,555 rows in the sample
One row per play. Key: play_id.
| bigint | Unique id. | |
| int | Who listened. | |
| int | What. | |
| timestamp | Start time (UTC). | |
| int | How long they listened. | |
| text | phone, desktop, speaker or car. |
Related questions
Loading the editor and PostgreSQL
Loading the editor and PostgreSQL