Worth Corner, Crawley, RH10 7SL

Support Hours - Mon-Sat, 8.00-18.00

Welcome to our SQL Server blog

This blog was created in order to pass on some of our knowledge and advice in the hope that the community might find it useful.

Obviously Microsoft SQL Server is our area of expertise and therefore this is our most thorough blog with everything from the basic through to the the incredibly advanced and, as such, we should have something for everyone within our pages.


Anti Semi Join - SQL Training Question
Published: Dec 03, 2020
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:

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.

Leave a Comment
Your email address will not be published. All fields are mandatory.
NB: Comments will only appear once they have been moderated.

SQL  World  CEO
Kevin  Urquhart

iPhone Selfie

I am a SQL Server DBA, Architect, Developer, Trainer, and CEO of SQL World. This is my blog in which I’m simply trying to share my SQL knowledge and experiences with the world.

Categories


© Copyright 2020 SQLTraining Ltd.