UNION ALL

Combines two SELECT results and keeps duplicates, which makes it faster than UNION.

sql
SELECT id FROM table1
UNION ALL
SELECT id FROM table2

When to use

Choose it when duplicates are wanted or cannot occur. Both queries need the same number of columns with compatible types, and column names come from the first query.

See PP 01.

Appears in

No references yet.