UNION and UNION ALL

UNION stacks the results of several queries that have the same number of columns with compatible types, and removes duplicates. UNION ALL keeps all duplicates and is faster because it skips the deduplication step. Column names come from the first query.

Example

SELECT email FROM clients
UNION ALL
SELECT email FROM prospects;

Related concepts

The whole glossary