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.

A ordem das linhas importa

PostgreSQLv16
Entre para enviar

O resultado da sua consulta aparecerá aqui

Focus radio
Paused · SomaFM · Fluid