PrepZone Logo
PrepZone
Back to Database

Database · Easy

UNION vs UNION ALL vs INTERSECT vs EXCEPT — differences and performance.

DatabaseSQLFresher

Answer preview

These are set operators: they stack the results of two queries vertically rather than joining them sideways. UNION removes duplicates, UNION ALL keeps everything, INTERSECT returns rows present in both, and EXCEPT (Oracle: MINUS) returns rows in the first result but not the secon…