Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle MINUS Operator

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

Oracle MINUS OPERATOR Syntax

To compares results of two SELECT statement and returns distinct rows from the first SELECT statement that aren't present in the second SELECT statement, use the following syntax:

Syntax

SELECT col1, col2 
FROM tablename1
MINUS
SELECT col1, col2 
FROM tablename2;

Parameters:

tablename1 & 2: The table name from which you want to achive MINUS operator.

.

Oracle MINUS OPERATOR example using LEFT JOIN

The following Oracle example to retrive all rows from the first SELECT statement that are not returned by the second SELECT statement:

Example

SELECT firstName
FROM tblcustomer
MINUS
SELECT firstName
FROM tblcustomerloan;

Note:

In the above example, the MINUS operator is uses to retrive all rows in the first SELECT statement that are not returned by the second SELECT statement.