Home › SQL Tutorial › SQL UNION and UNION ALL
SQL UNION and UNION ALL
Stack the results of two queries.
UNION joins the results of two SELECTs and removes duplicates. UNION ALL keeps duplicates. Both queries need the same number of columns with compatible types.
Example code
SELECT city FROM Customers WHERE country = 'UK'
UNION
SELECT city FROM Customers WHERE city = 'Paris'
ORDER BY city;