Categories
Database PostgreSQL

Oracle Calls It MINUS, PostgreSQL Calls It EXCEPT

Just in case I run into this again, you can use EXCEPT in PostgreSQL as a replacement for using MINUS in Oracle. This was extremely handy this morning when I ran a query on Oracle and wanted to see if I could do the same thing on exported data in PostgreSQL. Doing a cut-n-paste returned a syntax error because the query used MINUS. A couple of minutes with Google and the PostgreSQL documentation and I discovered that EXCEPT does the same thing that Oracle’s MINUS does. After changing that one word in the query it ran perfectly.

Honestly, I tried to resist the urge, but I just couldn’t. According to the MySQL future feature list MINUS, INTERSECT, and FULL OUTER JOIN will be implemented in the “mid-term future” (after 5.1).