|< < 21 > >|

Set operations

except all


select * from a except all select * from b

X
2
3
4
  • except all preserves duplicates.
  • The number of copies of an element in the result is the number of copies in the left input minus the number in the right operand.*


* The Postgres docs appear to be incorrect.
EXCEPT returns all rows that are in the result of query1 but not in the result of query2.
(This is sometimes called the difference between two queries.)
Again, duplicates are eliminated unless EXCEPT ALL is used.

I've submitted a correction.

|< < 21 > >|