1

I just saw this after seeing MINUS in this powerpoint and looking for more information.

MINUS Example The following statement combines results with the MINUS operator, which returns only unique rows returned by the first query but not by the second:

SELECT product_id FROM inventories
MINUS
SELECT product_id FROM order_items;

I'm just curious what's the historic reason for using MINUS instead of EXCEPT? Does anyone else use MINUS? I assume this predates the SQL Spec?

Evan Carroll
  • 3,398
  • 2
  • 16
  • 45
  • 6
    It probably stems from set theory. A database is just a set and the select is a subset. Some languages use a minus sign to remove one subset from another. – cup Sep 25 '18 at 03:59
  • EXCEPT was added in SQL-92, I suspect MINUS predates that (Oracle 7 had it, I can’t remember for sure but I think Oracle 6 might have had it too). I don’t have sources to hand to back that up though. – Stephen Kitt Sep 25 '18 at 09:14

0 Answers0