UNION Operators

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

Each SELECT statement within UNION must have the same number of columns.

The columns must also have similar data types.

The columns in each SELECT statement must also be in the same order.

Remove duplicates in the resultset.

select customerid,FirstName ,LastName from Chinook.Customer
UNION
select customer_id,customer_first_name,customer_last_name from murach.customers

UNION ALL

select customerid,FirstName ,LastName from Chinook.Customer
UNION ALL
select customer_id,customer_first_name,customer_last_name from murach.customers

Last updated