UNION ALL
UNION ALL is a SQL statement in the Set Operations category. Like UNION but does NOT remove duplicate rows. Faster because no dedup is needed. The syntax is SELECT columns FROM table1 UNION ALL SELECT columns FROM table2;. It returns combined rows (including duplicates). A typical example: SELECT product_id FROM orders_2024 UNION ALL SELECT product_id FROM orders_2025; -- All product IDs from both years (duplicates kept) A close relative is UNION, which combines results from two queries, removing duplicate rows. Each SELECT must have the same number of columns. A close relative is INTERSECT, which returns rows that appear in BOTH query results. Supported in PostgreSQL, SQL Server, Oracle. A close relative is EXCEPT / MINUS, which returns rows from the first query that do NOT appear in the second query results. More about this category: Set-based operations — UNION, UNION ALL, INTERSECT, EXCEPT. Related Set Operations entries: UNION, INTERSECT, EXCEPT / MINUS, INTERSECT ALL / EXCEPT ALL, Ordering Set Operations, TABLE Keyword, Set Operation Precedence, Set Operation with ORDER BY.