Oracle: MINUS operator

MINUS Operation in SQL helps return only those elements of a set that are not part of the other Set.

for example:

a = {1,2,3,4}

b = {1,2,7,8}

so, a - b or a MINUS b will be 3,4 as the numbers are only present in a and not in b.

NOTE: The result of a - b will not be equal to the result of b - a.

Syntax

Statement
MINUS
Statement;

Example

Following are Stu and Children table on which we want to perform the MINUS Operation:

Stu:

Stu table

Children:

Children

Now, we want to check those names that are present in table Stu and not in table Children:

Select name from Stu
MINUS
Select name from Children

Output

Operators

Here you can see all elements are present in the output except the name Radha which is available in Children table.