Quiz
6. Task 5: Subqueries

Instruction

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

Prison (Id, Name, Country)

Prisoner (Id, PrisonId, 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, name and country of location. Each prisoner also has an ID, prison ID, name and age.

Exercise

Show all columns for the prisons where there is at least one prisoner older than 50.

Stuck? Here's a hint!

Use the following template to help you build your query:

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