Loading exercise…
Loading exercise…
Exercises are built for a keyboard. Read the task here, then open this page on a laptop to solve it.
EXISTS and NOT EXISTS. EXISTS (subquery) is true when the subquery finds at least one row. Inside it, refer to the outer row (o.customer_id = c.customer_id), which makes it a correlated subquery: it's checked once per outer row. NOT EXISTS keeps the rows with no match, and unlike NOT IN it isn't tripped up by NULLs.
select p.product_name from products p where not exists ( select 1 from order_items oi where oi.product_id = p.product_id and oi.quantity >= 28 )
Customer success wants to call every customer who bought in the first half of 2025 but hasn't completed an order since.
Return customer_name and region for every customer with at least one completed order before 2025-07-01 and no completed order on or after 2025-07-01.
Loading the Brightline dataset…
Language
Full plan
SQL ✓ · Excel and Power BI also included
Cancel anytime · 14-day full refund · Secure payment by Stripe