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: query issue

Re: query issue

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Thu, 05 Feb 2004 12:39:07 -0800
Message-ID: <1076013496.70654@yasure>


curwen wrote:

>>To add to what Daniel said.. in a blunt way using nice friendly
>>letters... empty your cup of preconceptions of what you think a RDBMS
>>is and then fill it with some RTFM'ing.

>
>
> I know you'll probably start to rolling on the floor laughing,
> but I'm gonna ask anyway:
> what the h*** is a rtfm'ing ?

Read The F(ine) Manual.

or something reasonably close to that dending on what you put between the parentheses.

> hey, what's up ?
> I'm writing in a It Professional newsgroup
> I'm expecting to find people smart enough to understand even if I
> don't write it down entirely what I was trying to say.. ;)

Your lucky we speak the same language. Lower your expectations ;-)

> anyway, to explain myself better, the desidered behaviour is the one
> that comes out from the following:
>
> select n_id,n_number,fk1 FROM numbers
> where n_id in
> (select max(n_id) from numbers group by n_number)
>
> I'm just worried about performances:
> my question was :'is there any way to avoid nestes queries'?
>
> ps ..and getting the same result, of course
>
> regards
> jc

Depending on many factors I would look at using EXISTS rather than IN or look at using an in-line view.

Go to http://www.psoug.org/reference/explain_plan.html and look at test statements 1 - 6. Six different ways to produce the exact same result set.

The statement with NOT IN (#5) turns out to be among the best so don't drop the subquery just because of some visual thing. Drop it only if you have a better method for solving the problem.

-- 
Daniel Morgan
http://www.outreach.washington.edu/ext/certificates/oad/oad_crs.asp
http://www.outreach.washington.edu/ext/certificates/aoa/aoa_crs.asp
damorgan_at_x.washington.edu
(replace 'x' with a 'u' to reply)
Received on Thu Feb 05 2004 - 14:39:07 CST

Original text of this message

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