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.
Exemplo de resposta esperada
É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.
| user_id | played_at | minutes_since_prev |
|---|---|---|
| 1 | 2026-05-01T09:03:00 | 3 |
| 1 | 2026-05-01T09:10:00 | 7 |
| 1 | 2026-05-01T10:00:00 | 50 |
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
Entrar