Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Diff. between UNION and UNION ALL

Re: Diff. between UNION and UNION ALL

From: AMARENDRA B NETTEM <nettama_at_charlie.cns.iit.edu>
Date: 1997/03/01
Message-ID: <01bc25e3$0d7fbb50$81a757c6@vanaja>#1/1

Hi Naren,

  For example if you have two tables named T1 and T2, then

...........................................

Table T1                       table T2
---------                     -----------
ename varchar2(12)             name   varchar2(12)

 A                               C
 B                               D

 C
 D
..........................................

SELECT ename FROM t1
 UNION
SELECT name FROM t2
 RESULT : A B C D ( DISTINCT VALUES)

.............................................

SELECT ename FROM t1
 UNION ALL
SELECT name FROM t2
 RESULT : A B C D C D ( including DUPLICATE VALUES).

............................................


Hope this helps

-- 
    AMARENDRA B NETTEM
    ORACLE CONSULTANT
    WHITTMAN-HART INC., CHICAGO
    (http://www.iit.edu/~nettama)


Naren Chintala <naren_at_mink.att.com> wrote in article
<33173071.8F9_at_mink.att.com>...

> Hi,
>
> What's the difference between UNION and UNION ALL (in a SELECT
> statement). I don't find any info on this in the Oracle manuals. Would
> someone explain this with a simple example.
>
> TIA
>
> Naren
>
Received on Sat Mar 01 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US