Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
Combines results from multiple SELECT statements. UNION DISTINCT
removes duplicate rows, while UNION ALL
does not remove them. UNION
is equivalent to UNION DISTINCT
.
SELECT ...
UNION [ALL | DISTINCT] SELECT ...
[UNION [ALL | DISTINCT] SELECT ...]
SELECT
statements must select the same number of columns.SELECT * FROM table_a UNION ALL SELECT * FROM table_b;
SELECT * FROM table_a UNION SELECT * FROM table_b;