Loading…
EXISTS returns TRUE if the subquery returns any rows:
SELECT * FROM customers c
WHERE EXISTS (
SELECT 1 FROM orders o
WHERE o.customerId = c.id
);
This finds customers who have at least one order.
Find all customers who have at least one completed order (status = 'completed').
Return customer name and email.
Downloading SQL engine… (one-time)
This runs entirely in your browser and is cached for next time.