Save up to $499! Grab all Python courses for$49 or all online courses we’ve ever launched for only \$169. Only Feb 11-16. Happy Valentine's!
Introduction
Very simple subqueries
Subqueries with multiple results
Correlated subqueries
15. The operator EXISTS
Other subqueries

## Instruction

Awesome! Let's learn another new operator, then. Consider the following:

SELECT
*
FROM city
WHERE EXISTS (
SELECT
*
FROM trip
WHERE city_id = city.id
);


EXISTS is a new operator. It checks if there are any rows that meet the condition.

In our case, the whole query will show only such cities where there is at least one trip (where there exists a trip) organized by our travel agency. Cities with no trips will not be shown.

## Exercise

Select all countries where there is at least one mountain.

### Stuck? Here's a hint!

Type:

SELECT
*
FROM country
WHERE EXISTS (
SELECT
*
FROM mountain
WHERE country_id = country.id
);