← All Exercises

EXISTS vs IN Subqueries

intermediatesql~20min

Background

EXISTS is often more efficient than IN for correlated subqueries with large datasets.

Problem

Find customers who have placed orders using both EXISTS and IN, comparing performance.

Input

Customers and orders tables

Output

Customers with orders

Sample tests

Sample 1

Input: customers with at least one order
Expected: matching customers

Your solution

Learning objective

Learn subquery patterns and performance tradeoffs