EXCEPT vs. LEFT OUTER JOIN

The EXCEPT operation was added to SQL Server in 2005. The operation compares the results of two sets. The results of the first set returns a list for every DISTINCT row that does not have a matching row in the second set.
This is the equivalent of executing a SELECT DISTINCT from some object, joining to a second set using a LEFT OUTER JOIN, and specifying that the outer table record be null.
Both queries perform the same function. When, then, is the EXCEPT operation necessary? Perhaps it makes things easier to understand when working with sets.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s