Skip to content

Listens by hour of day

EasyFull bankDates and timeRatios and percentages10 min2 hidden datasets

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 23
  • listens: 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.

intUnique id.
dateDay they joined.
textTwo-letter country code.
textfree, premium or family.
artists30 rows in the sample

One row per artist. Key: artist_id.

intUnique id.
textName.
textpop, rock, hip-hop, electronic, jazz or folk.
tracks116 rows in the sample

One row per track. Key: track_id.

intUnique id.
textTrack title.
intMain artist.
intLength.
dateRelease day.
plays6,555 rows in the sample

One row per play. Key: play_id.

bigintUnique id.
intWho listened.
intWhat.
timestampStart time (UTC).
intHow long they listened.
textphone, desktop, speaker or car.

Related questions

Loading the editor and PostgreSQL