Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
UNION
INTERSECT
EXCEPT
11. MINUS instead of EXCEPT

Instruction

Nice! Remember how we explained EXCEPT and we said that it returns the rows from the first table MINUS the rows from the second table? The choice of words was no coincidence: some databases use the keyword MINUS instead of EXCEPT.

You should therefore always check your database documentation before writing such queries.

There are also some databases which support both words, just like our database – so why not try an exercise?

Exercise

Find all the years when there was at least one medal in skating but no medals in cycling. Use the keyword MINUS.

Stuck? Here's a hint!

Type:

SELECT year
FROM skating
MINUS
SELECT year
FROM cycling;