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.
Note (1):- The expressions must be same in number for both the SELECT statement and have similar datatype.
Example:-
Syntax:-
Explanation:-
Example:-
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.
Note (1):- The expressions must be same in number for both the SELECT statement and have similar datatype.
Example:-
Syntax:-
SELECT expression1, expression2, ... expression_n FROM table1 WHERE conditions MINUS SELECT expression1, expression2, ... expression_n FROM table2 WHERE conditions;
Explanation:-
- expression1, expression2, ... expression_n:- It specifies the columns that you want to retrieve.
- table1, table2:- It specifies the tables that you want to retrieve records from.
- conditions:- It specifies the conditions that must be fulfilled for the records to be selected.
Example:-
SELECT supplier_id FROM suppliers MINUS SELECT supplier_id FROM order_details;