SQL UNIONS

UNION

The SQL UNION operator combines the result of two or more SELECT statements.

Note:- 1.Each SELECT statement within the UNION must have the same number of columns.
2.The columns must also have similar data types.
3.The columns in each SELECT statement must be in the same order.

UNION ALL

The UNION operator selects only distinct values by default. To allow duplicate values, use the ALL keyword with UNION.

Advertisements