Practice · Economy · Hard
For each year, return year, rate_pct, and the change in the rate from the previous year as delta (1 decimal), oldest first.
Runs in your browser. No signup needed.
inflation(year, rate_pct). Use rate_pct − LAG(rate_pct) OVER (ORDER BY year), wrapped in ROUND(…, 1).
SELECT year, rate_pct,
ROUND(rate_pct - LAG(rate_pct) OVER (ORDER BY year), 1) AS delta
FROM inflation
ORDER BY year;
The reference solution is checked automatically when you run your query on the practice page — results are compared row by row, and order matters for this one.
Inflation jumped from ~5% in 2021 to ~34% by 2023 — the delta column makes that shock jump off the page. (World Bank / CBE)