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

Home -> Community -> Mailing Lists -> Oracle-L -> OR Vs UNION

OR Vs UNION

From: <Saminathan_Seerangan_at_i2.com>
Date: Mon, 23 Jun 2003 21:55:17 -0700
Message-ID: <F001.005B834B.20030623213452@fatcity.com>

Hi All,

Could someone explain to me which one is best in the following two queries w.r.t performance?

Thanks
Sami

Query1)



select distinct empployee_id from employees where department_id=10 or department_id=20
/

Query2)



select employee_id from employees where department_id=10 union
select employee_id from employees where department_id=20
/
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Jun 23 2003 - 23:55:17 CDT

Original text of this message

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