Practice · Economy · Hard

Year-on-year inflation swing

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.

What you are given

inflation(year, rate_pct). Use rate_pct − LAG(rate_pct) OVER (ORDER BY year), wrapped in ROUND(…, 1).

Starting point

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.

Did you know

Inflation jumped from ~5% in 2021 to ~34% by 2023 — the delta column makes that shock jump off the page. (World Bank / CBE)

More Economy challenges

Open it in the playground →