Lesson 11 of 22 · SQLite

Subqueries

Write SQL subqueries: put one query inside another with WHERE … IN (…).

A query nested inside another query.

Syntax

SELECT name FROM person
WHERE id IN (
    SELECT person_id FROM get_fit_now_member
    WHERE membership_status = 'gold'
);

Your challenge

Using a subquery, list the names of people who have a gold gym membership.

Solve it in your browser

Free, no sign-up. The SQLite database runs in your browser; your answer is checked instantly, with hints if you need them. Plus a 1-question quiz.