Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLEXISTS vs INSingle-choice MCQ

Why might IN with a subquery and EXISTS with the same correlation produce identical results yet the optimizer treats them differently?

-- A: SELECT * FROM customers c WHERE c.id IN (SELECT o.customer_id FROM orders o); -- B: SELECT * FROM customers c WHERE EXISTS (SELECT 1 FROM orders o WHERE o.customer_id = c.id);