There are some rules that you need to follow in order to use the UNION operator:
The number of columns appears in the corresponding SELECT statements must be equal.
The columns appear in the corresponding positions of each SELECT statement must have the same data type or at least convertible data type.
By default, the UNION operator eliminates duplicate rows from the result even if you don’t use DISTINCT operator explicitly. Therefore it is said that UNION clause is the shortcut of UNION DISTINCT .
If you use the UNION ALL explicitly, the duplicate rows, if available, remain in the result. The UNION ALL performs faster than the UNION DISTINCT .