AnalystPath

Members With Both Plans

SQLEasyJunior level~15 min

Problem

A boutique gym sells passes under several plan names. Find every distinct `member_id` that has purchased at least one **Yoga** pass and at least one **Spin** pass. Return one row per qualifying member in the column `member_id`, ordered by `member_id` ascending.

Tables

Example rows — the live problem includes the full dataset.

GymPasses
pass_idmember_idplan_name
11501Yoga
12501Pilates
13501Spin

Expected output

Your answer should return 2 rows with the columns member_id.

Starter code (SQL)

SELECT *
FROM GymPasses;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions