Tidy Track Plays by Month
Problem
A streaming log stores a song title and a play date for every play. The titles were entered carelessly: inconsistent capitalisation and stray leading/trailing spaces.
Normalise each title to lowercase with surrounding spaces removed, and report the **number of plays per cleaned title per calendar month**.
Return `track` (cleaned title), `month` (formatted `YYYY-MM`), and `plays`. Order by `track`, then `month`.
Tables
Example rows — the live problem includes the full dataset.
| play_id | song_title | played_on |
|---|---|---|
| 1 | NEONRAIN | 2010-01-16 |
| 2 | NeonRain | 2010-01-17 |
| 3 | nEoNrAiN | 2010-02-18 |
Expected output
Your answer should return 4 rows with the columns track, month, plays.
Starter code (SQL)
SELECT *
FROM plays;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock