Minus operator

Oracle MINUS operator

In Oracle, MINUS operator is used to return all rows in the first SELECT statement that are not returned by the second SELECT statement.

Each SELECT statement has a dataset and the MINUS operator returns all documents from the first dataset and then removes all documents from the second dataset.

For example

Oracle Minus Operator


  1. SELECT expression1, expression2, ... expression_n  
  2. FROM table1  
  3. WHERE conditions  
  4. MINUS  
  5. SELECT expression1, expression2, ... expression_n  
  6. FROM table2  
  7. WHERE conditions;  



1) expression1, expression2, ... expression_n: It specifies the columns that you want to retrieve.

2) table1, table2: it specifies the tables that you want to retrieve records from.

3) conditions: it specifies the conditions that must be fulfilled for the records to be selected.

Note: The expressions must be same in number for both the SELECT statement and have similar datatype.

Oracle MINUS Example

This example will return one field with the same datatype from two tables "suppliers" and "order_details".

  1. SELECT supplier_id  
  2. FROM suppliers  
  3. MINUS  
  4. SELECT supplier_id  
  5. FROM order_details;  



Oracle Minus Operator 2