Plays in the first two weeks for April joiners
The task
The growth team measures early engagement. Take every listener whose joined_on is in April 2025 (2025-04-01 to 2025-04-30 inclusive).
A play counts as an early play when it happened in the listener's first 14 days: from the start of the joining day up to, but not including, the start of the 14th day after it. In other words played_at >= joined_on and played_at < joined_on + 14 days.
Return listener_id and early_plays (the number of early plays, 0 if none) for each of those listeners. Sort by listener_id.
Expected output
listener_idearly_plays- Sorted by listener_id ascending.
- 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