SQL Joins and Subqueries/Combine result sets with UNION ALL

Merge all rows without deduplication.

Section: EXISTS and Set Operations

Combine result sets with UNION ALL

sql
sql
SELECT event_type FROM web_events
UNION ALL
SELECT event_type FROM mobile_events;
Explanation

UNION ALL is usually faster than UNION because it skips duplicate elimination.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing EXISTS and Set Operations
Combine result sets with UNION
Merge distinct rows from two compatible queries.
OpenIn sheetsqlsame section
Find common rows with INTERSECT
Return rows present in both queries.
OpenIn sheetsqlsame section
Subtract rows with EXCEPT
Return rows from the first query not present in the second.
OpenIn sheetsqlsame section
Filter with EXISTS
Return rows when a related row exists.
OpenIn sheetsqlsame section
Filter with NOT EXISTS
Return rows with no related matches.
OpenIn sheetsqlsame section
Join with additional predicate
Add extra conditions to the join itself.