Gaps between plays
Gaps between plays
You are a product analyst at the music streaming service TuneWave. The recommendations team wants to know how densely listeners consume tracks: short pauses mean continuous playlist listening, long ones mean the person re-opened the app. You have the track-start log play_events: who pressed Play and when.
For every event, compute how many minutes passed since the previous event of the same user. Skip the very first event of each user — there is nothing to compare it with.
Return columns:
- user_id — listener identifier;
- played_at — track start time (timestamp, as stored);
- minutes_since_prev — whole number of minutes since the user's previous event (all gaps in the data are exact minutes).
Sort by user_id ascending, then played_at ascending. Users with a single event do not appear in the output. Timestamps never repeat within one user.
Row order matters
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in