Listening Hours by Month
Listening Hours by Month
You are a product analyst at Wavelane, a music streaming service. The growth team tracks engagement and wants a monthly view: how many plays users started and how many total hours of music they listened to. In play_events each row is a single playback with its exact start time and duration in seconds.
Group the plays by calendar month and compute totals. A month must be represented by its first day. A play belongs to the month of its start moment, even if it lasted into the next month.
Return columns:
- month_start — first day of the month (date, YYYY-MM-DD);
- plays_cnt — number of plays in the month (integer);
- hours_listened — total listening hours, rounded to 1 decimal.
Sort by month_start ascending. Zero-length plays count towards plays_cnt but add 0 hours. Months without events must not appear.
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.
| month_start | plays_cnt | hours_listened |
|---|---|---|
| 2026-01-01 | 3 | 0.7 |
| 2026-02-01 | 4 | 0.9 |
| 2026-03-01 | 4 | 1.1 |
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
Entrar