In the next three sections, I’ll cover the UNION, INTERSECT, and EXCEPT set operators, which combine the results of two SELECT statements into a single result. These operators can be mixed and chained to combine more than two tables. The UNION operator is supported widely; the other two operators, less so.
A UNION operation combines the results of two queries into a single result that comprises the rows returned by both queries. (This operation differs from a join, which combines columns from two tables.) A UNION expression removes duplicate rows from the result; a UNION ALL expression doesn’t remove duplicates.
Unions are simple, but they have some restrictions:
The SELECT-clause lists in the two queries must have ...