Chapter 6. Set Operations

Set operations are operations between two input sets—or more accurately, multisets—resulting from two input queries. Remember, a multiset is not a true set because it can contain duplicates. When I use the term multiset in this chapter, I’m referring to the intermediate result sets from two input queries that may contain duplicates. Although there are two multisets as inputs to a SQL set operation, the final output is still one result set that may also be a multiset.

T-SQL supports three set operations: UNION, INTERSECT, and EXCEPT. ...

Get Microsoft® SQL Server® 2008 T-SQL Fundamentals now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.