Index Ai Academy
Glossary · Phase 7 · Software engineering

Anti-join

Also written: anti-joins

Finding rows with no match in another table, usually a LEFT JOIN followed by WHERE ... IS NULL.

An ordinary (inner) join keeps only rows that match on both sides. A LEFT JOIN keeps every row of the left table, filling the right side's columns with NULL where nothing matches. That makes it the tool for questions about absence: which products haven't sold, which customers never ordered. The pattern, called an anti-join, is a left join followed by WHERE right_side.key IS NULL.

Try it now

SQL is written SELECT first but worked out in this order, which is why a WHERE can't use a column alias but ORDER BY can.

Learn it properly

SQL for analysis · Subqueries, CASE, common table expressions, outer joins and window functions on real order data. About 45 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write