# Explain UNION, MINUS, UNION ALL and INTERSECT

Answer posted by Scott on 2005-05-25 18:32:51: UNION - the values of the first query are returned with the values of the second query eliminating duplicates.
MINUS - the values of the first query are returned with duplicates values of the second query removed from the first query.
UNION ALL - the values of both queries are returned including all duplicates
INTERSECT - only the duplicate values are returned from both queries.

rampratap409

• Member Since Sep-2006 | Dec 7th, 2006

UNION: Take the common record once( No Duplicate)

UNION ALL : Takes Duplicates also

Minus:  Result of first query - result of second query

examle

select * from emp where rownum<=9;

minus

select * from emp where rownum<9;

this will display 9th row of emp

Intersect:  common result of both query

#### Scott

• May 25th, 2005

UNION - the values of the first query are returned with the values of the second query eliminating duplicates.
MINUS - the values of the first query are returned with duplicates values of the second query removed from the first query.
UNION ALL - the values of both queries are returned including all duplicates
INTERSECT - only the duplicate values are returned from both queries.

#### Pankaj & Sunil

• Sep 10th, 2005

Union Will eliminate duplicate rows from both the tables which are participating in the union operation

#### Atal Profile Answers by Atal

• Sep 16th, 2005

UNION: Take the common record once( No Duplicate)

UNION ALL : Takes Duplicates also

Exampl : Say there is EMP having 14 reconds then...

select count(1) from (select ename from emp)  returns 14

select count(1) from (select ename from emp union  select ename from emp e1) returns 14

But

select count(1) from (select ename from emp union All select ename from emp e1)

returns 28.

#### rampratap409 Profile Answers by rampratap409 Questions by rampratap409

• Dec 7th, 2006

UNION: Take the common record once( No Duplicate)

UNION ALL : Takes Duplicates also

Minus:  Result of first query - result of second query

examle

select * from emp where rownum<=9;

minus

select * from emp where rownum<9;

this will display 9th row of emp

Intersect:  common result of both query