intermediateSet Operators — UNION, INTERSECT, EXCEPT/MINUS

What does A EXCEPT B return, and why does argument order matter?

It returns rows present in A but not in B. Order matters because EXCEPT is not symmetric — B EXCEPT A answers a completely different question (rows in B but not in A), so swapping the operands is a silent logic bug, not something that throws an error.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

Continue to What requirement must both queries satisfy before you can combine them with a set operator?← Back to all SQL questions