Practice · Economy · Medium

Every year we have data for

Return a single de-duplicated, sorted list of every year that appears in either the inflation table or the crops table, in a column named year.

Runs in your browser. No signup needed.

What you are given

SELECT year FROM inflation UNION SELECT year FROM crops.

Starting point

SELECT year FROM inflation
UNION
SELECT year FROM crops
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

UNION lets you pool a dimension (here, years) from tables that don’t otherwise join — handy for building a complete axis. (SQLite docs)

More Economy challenges

Open it in the playground →