Oracle_Union
Oracle_Union
INTERSECT , MINUS
Union All :
UNION :
Example :
SELECT last_name FROM employees - 10
INTERSECT
SELECT last_name FROM contacts -10
ORDER BY last_name; --29 RECORDS
1 field
2 records
Emp -10
Dept -10
6 fields
10 records
MINUS :
MINUS operator is used to return all rows in the first SELECT statement
that are not in the second SELECT statement.
The MINUS operator is used to subtract the result set obtained by first
SELECT query from the result set obtained by second SELECT query.
The MINUS operator returns rows in the first query that are not present
in the second query.
The following picture illustrates the result of the MINUS of T1 and T2:
Here are the last names returned by the first query but are
not found in the result set of the second query:
Example :
SELECT last_name FROM employees
minus
SELECT last_name FROM contacts
ORDER BY last_name;