Instruction
Good! Remember the NOT operator? We can use it together with EXISTS. Take a look:
SELECT
*
FROM City
WHERE NOT EXISTS (
SELECT
*
FROM Trip
WHERE Trip.CityID = City.ID
);
As you probably guessed, this query will find all cities that don't have any trips organized in them.
Exercise
Select all mountains with no hiking trips to them.
Stuck? Here's a hint!
Type:
SELECT
*
FROM Mountain
WHERE NOT EXISTS (
SELECT
*
FROM HikingTrip
WHERE HikingTrip.MountainID = Mountain.ID
);



