SQL Set Operations
Set-based operations — UNION, UNION ALL, INTERSECT, EXCEPT. This category documents 25 SQL set operations entries, and each page gives you the full syntax, the parameter list, the return value, and a runnable example tested against MySQL, PostgreSQL, SQL Server, and SQLite. The entries are: UNION, UNION ALL, INTERSECT, EXCEPT / MINUS, INTERSECT ALL / EXCEPT ALL, Ordering Set Operations, TABLE Keyword, Set Operation Precedence, Set Operation with ORDER BY, Set Operations with Different Columns, Set Operations with GROUP BY, SQL PIVOT / UNPIVOT (Standard), Column Count Matching (Set Ops), Set Operations with CTE, EXCEPT with ORDER BY, UNION with Column Aliases, Set Operations Subquery, UNION with Subquery, EXCEPT with Multiple Columns, INTERSECT with ORDER BY, SET Operations with NULLs, UNION ALL with LIMIT per Branch, UNION with Aggregation, UNION ALL for Pivot Alternative, SQL INTERSECT with Multiple Tables. Not sure where to start? UNION and UNION ALL are the most commonly used entries in this category. You can also search across every category from the search page, browse the complete A–Z index, or try any of these statements live in the SQL playground.