Quiz
6. Task 5 - Subqueries

Instruction

That's right. Keep it up! Do you still remember subqueries, then? Let's see.

prison (id, name, country)

prisoner (id, prison_id, name, age)

The tables represent some of the most dangerous prisons in the world and a few fictional prisoners who serve their sentences there.

Each prison has an id, its name and the country where it's located. Each prisoner also has an id, the id of their prison, a name and a specific age.

Exercise

Show all columns for the prisons where there is at least one prisoner above 50 years of age.

Stuck? Here's a hint!

Use the following template to help you build your query:

SELECT
  ... 
FROM ... 
WHERE EXISTS (
  SELECT
    ... 
  FROM ...
  WHERE ... AND ...
);