xxxxxxxxxx
-- Assume we have two tables: Customers and Suppliers
-- We want to retrieve the names of all customers and suppliers in a single result set
-- Query to select customers
SELECT 'Customer' AS Type, CustomerName AS Name
FROM Customers
-- Query to select suppliers
UNION ALL
SELECT 'Supplier' AS Type, SupplierName AS Name
FROM Suppliers
xxxxxxxxxx
SELECT expression1, expression2, expression_n
FROM tables
[WHERE conditions]
UNION ALL
SELECT expression1, expression2, expression_n
FROM tables
[WHERE conditions];
xxxxxxxxxx
UNION ALL:
COMBINES THE RESULT OF 2 QUERY AND
DOESN'T REMOVE DUPLICATE ROWS
AND DOESN'T SORT BY FIRST COLUMN