SQLite UNION ALL Operator
The UNION ALL Operator
UNION ALL works like UNION, but it keeps the duplicate rows. It is also faster, because SQLite does not need to look for duplicates.
This example returns the cities of all the customers and suppliers, with duplicates:
Example
SELECT City FROM Customers
UNION ALL
SELECT City FROM Suppliers
ORDER BY City;
Try it Yourself »
UNION ALL With WHERE
Example
Select the German cities, with duplicates:
SELECT City, Country FROM Customers
WHERE Country = 'Germany'
UNION ALL
SELECT City, Country FROM Suppliers
WHERE Country = 'Germany'
ORDER BY City;
Try it Yourself »