Anti Semi Join - SQL Training Question
Published: Jul 12, 2026
This is related to my previous post about the Semi Join and came up under the same context. But this time we’re looking at the Anti Semi Join.
Again, as with the Semi Join, this is something that you’re likely to have come across but without ever knowing it.
The pure definition is nice and simple as it’s very similar to the Semi Join:
Return all records from Table A where the record (based on the specified matching criteria) is not present in Table B.
For example:
In the above I chose to use a NOT IN instead of a NOT EXISTS… they’re identical to the Optimizer and I felt like a change having used EXISTS in my Semi Join blog.
Again, as with the Semi Join, this is something that you’re likely to have come across but without ever knowing it.
The pure definition is nice and simple as it’s very similar to the Semi Join:
Return all records from Table A where the record (based on the specified matching criteria) is not present in Table B.
For example:
select *
from Production.product p
where productID not in
(
select productID
from Production.TransactionHistoryArchive
)
In the above I chose to use a NOT IN instead of a NOT EXISTS… they’re identical to the Optimizer and I felt like a change having used EXISTS in my Semi Join blog.