Both UNION and UNION ALL concatenate the result of two different SQLs. They differ in the way they handle duplicates.
-
UNION operator performs a DISTINCT on the result set, eliminating any duplicate rows.
-
UNION ALL operator does not remove duplicates, and it therefore faster than UNION.
SELECT column_name(s) FROM table_name1
UNION | UNION ALL
SELECT column_name(s) FROM table_name2