UNION and UNION ALL both are used to combine the results sets into one single results set, But following are the difference between the both operators.
#.
|
UNION
|
UNION ALL
|
1
|
UNION removes duplicate records from the two or more results sets
|
UNION ALL doen’t remove duplicate records from the two or more results
sets
|
2
|
UNION Sorts the data from the
results sets
|
UNION ALL doesn’t Sorts the data from the results sets
|
3
|
By compare with union all, union is much
less performance. Because of it must scan the result for duplicates
|
UNION ALL performance is more comparing with UNION
|