Skip to content
Aabha AI Academy
Skip to reading

SQL

08 Exists

-- 08_exists: Find customers without a completed order
-- Read-only reference query. Setup must be loaded first.
SELECT c.customer_id,c.customer_name FROM aabha_sql.customers AS c
WHERE NOT EXISTS (SELECT 1 FROM aabha_sql.orders AS o
 WHERE o.customer_id=c.customer_id AND o.status='completed')
ORDER BY c.customer_id;

Download this source file