AnalystPath

Tidy Track Plays by Month

SQLEasyJunior level~15 min

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.

plays
play_idsong_titleplayed_on
1NEONRAIN2010-01-16
2NeonRain2010-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

Related SQL questions