You're a product analyst at Wavelane, a music streaming service. The growth team wants monthly engagement figures: how many plays users started and how many total hours of music they listened to. Each row in play_events is one play, with its exact start time and duration in seconds.
Group plays by calendar month and calculate the totals. Represent each month by its first day. Assign each play to the month in which it started, even if it continued into the next month.
Return these columns:
- month_start — the first day of the month (a date in YYYY-MM-DD format);
- plays_cnt — the number of plays in that month (integer);
- hours_listened — the total listening time in hours, rounded to 1 decimal place.
Sort by month_start in ascending order. Include zero-duration plays in plays_cnt, but count them as 0 hours. Omit months with no events.
month_startplays_cnthours_listenedShowing the first 3 rows of the sample — the full sample comes with Premium
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign in