Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

UNION ALL

UNION ALL

The UNION ALL command merges the result sets of two or more SELECT statements, including duplicate values.

The provided SQL statement retrieves the cities (including duplicate values) from both the “Customers” and the “Suppliers” table:

Example

SELECT City FROM Customers
UNION ALL
SELECT City FROM Suppliers
ORDER BY City;