Use LEFT JOIN plus NULL filtering to find unmatched rows.
Section: Join Conditions and Filters
Find missing related rows
sql
sql
SELECT c.customer_id
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.customer_id
WHERE o.order_id IS NULL;Explanation
This is a common anti-join pattern.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Join Conditions and Filters