SQL Playground
TutorialsPlayground
SQL FormatterSQL MinifierSyntax ValidatorJSON to SQLCSV to SQLSQL to JSONER Diagram Generator
Daily ChallengeInterviewsCheat SheetBlog

© 2026 SQL Playground. Built for developers.

PrivacyTermsAboutRSS Feed
SQL Playground
TutorialsPlayground
SQL FormatterSQL MinifierSyntax ValidatorJSON to SQLCSV to SQLSQL to JSONER Diagram Generator
Daily ChallengeInterviewsCheat SheetBlog
Initializing...
Chapter 5: Subqueries
5-2
Your Progress

IN with Subquery

You can use a subquery with the IN operator to filter based on a list of values returned by the inner query.

-- Find users who are in the 'admins' table
SELECT * FROM users 
WHERE id IN (SELECT user_id FROM admins);

Task: Find all users who have placed at least one order (i.e., their ID is in the orders table).

Loading...
Run a query to see results