UNION [ALL]¶
The UNION
set operation clause combines the result sets of two or more SELECT
statements, removing duplicates.
The UNION ALL
set operation clause combines the result sets of two or more SELECT
statements, allowing duplicates.
Syntax¶
SELECT <column_name> [ ,... ]
FROM <table1>
UNION [ ALL ]
SELECT <column_name> [ ,... ]
FROM <table2>
Arguments¶
Parameter |
Description |
---|---|
|
The columns to retrieve |
|
The table from which to retrieve the data |
|
The table from which to retrieve the data |
|
Allows the |
Examples¶
UNION
¶
SELECT
city
FROM
customers
UNION ALL
SELECT
city
FROM
suppliers;
UNION ALL
¶
SELECT
city
FROM
customers
UNION ALL
SELECT
city
FROM
suppliers;