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

Home -> Community -> Usenet -> c.d.o.misc -> Re: AND or UNION

Re: AND or UNION

From: Mark Rosenbaum <mjr_at_netcom.com>
Date: 1997/02/13
Message-ID: <mjrE5Jo57.2pE@netcom.com>#1/1

In article <5du3di$rel_at_ustsu10.ust.hk>,
Wong Chung Yin <cscywong_at_ug.cs.ust.hk> wrote:
>Wong Chung Yin (cscywong_at_ug.cs.ust.hk) wrote:
>: Hi,
>: Which one is more efficient?
 

>: 1. select * from empdemo where empdemo = 0 and empdemo = 1;
>
>sorry . change to:
> 1. select * from empdemo where empdemo = 0 or empdemo = 1;
>
>: 2. select * from empdemo where empdemo = 0
>: union
>: select * from empdemo where empdemo = 1;
>

I believe that a union becomes a union all and then a sort to eliminate dups. Not only is the second query not going to give you the right answer it will be slow doing it. If you would like to do a performance comparison you can use explain plan and tk something or other. After trying that I'm sure many of us would be interested in the results. 8-}

mjr Received on Thu Feb 13 1997 - 00:00:00 CST

Original text of this message

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