Skip to content

Share of June plays by device

MediumFull bankGroup and aggregateRatios and percentages12 min2 hidden datasets

The task

Product wants to know which devices people use for real listening in June 2025. A play counts when played_at is on or after 2025-06-01 00:00:00 and before 2025-07-01 00:00:00, and seconds_played is at least 30.

Return device, plays (the number of counted plays on that device) and share_pct, the percentage of all counted plays that happened on that device, rounded to 1 decimal place. Devices with no counted plays are left out.

Sort by plays descending, then device ascending.

Expected output

deviceplaysshare_pct
  • Sorted by plays descending, then device 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