FunctionRacerProblemsRace

Month Over Month

HardSQLSQLite

day is a date written as text, like 2026-03-14. Return one row per month that has sales, earliest first: month (the first 7 characters of the date), total (the sum of amount in that month) and growth: how much the total rose from the month before it in the result, as a percentage of that earlier total, rounded to 1 decimal. A fall is negative, and the first month's growth is NULL.

Example 1

sales
iddayamount
12026-01-05100
22026-01-20100
32026-02-01250
42026-03-09200
returns
monthtotalgrowth
2026-01200NULL
2026-0225025.0
2026-03200-20.0

Constraints

Race itor take your time

Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.

More SQL problems