Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
UNION
INTERSECT
EXCEPT
10. How EXCEPT works

Instruction

Good job!

The next keyword is: EXCEPT. Let's change our example one more time:

SELECT
  Person
FROM Cycling
WHERE Country = N'Germany'
EXCEPT
SELECT
  Person
FROM Skating
WHERE Country = N'Germany';

So what does EXCEPT do? It shows all the results from the first table with the exception of those that also appeared in the second table.

In our example, we will see all people from Germany who won a medal in cycling EXCEPT the people from Germany who also won a medal in skating.

Exercise

Find all countries that have a medal in cycling but not in skating.

Stuck? Here's a hint!

Type:

SELECT
  Country
FROM Cycling

EXCEPT

SELECT
  Country
FROM Skating;