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: Wolf Kammer <uzr10a_at_work6c.rhrz.uni-bonn.de>
Date: 1997/02/13
Message-ID: <Pine.A32.3.93.970213111954.21812A-100000@work6c.rhrz.uni-bonn.de>#1/1

On 13 Feb 1997, N Prabhakar wrote:

> cscywong_at_ug.cs.ust.hk (Wong Chung Yin) wrote:
> >Hi,
> > Which one is more efficient?
> >
 

> >1. select * from empdemo where empdemo = 0 and empdemo = 1;

This select will select nothing since it looks for cases where empdemo=0 and empdemo=1 which is never true!

Take it easy, it can happen!

> >2. select * from empdemo where empdemo = 0
> > union
> > select * from empdemo where empdemo = 1;
>
> Hi there,
>
> You should use 'IN' "in (0,1)" clause which will use index and it will be
> more efficient.
>
> Regards
>
> N.Prabhakar
>
>
>
>
>
Received on Thu Feb 13 1997 - 00:00:00 CST

Original text of this message

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