Difference between union and union all?
Difference between union and union all?
UNION ALL keeps all of the records from each of the original data sets, UNION removes any duplicate records. Union is more expensive than Union All since Union needs to eliminate duplicates form the resultset.
In SQL Server UNION first performs a sorting operation and eliminates of the records that are duplicated across all columns before finally returning the combined data set.
If you are interested to know further please have a look a below link: