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: sql

Re: sql

From: Brian E Dick <bdick_at_cox.net>
Date: Tue, 24 Sep 2002 19:33:29 GMT
Message-ID: <d63k9.23183$IL6.1312087@news2.east.cox.net>


What? You want performance, too? <g>

I was a bit quick with the send button. How about

    select max(c) from t where c < (select max(c) from t)

What effect would a descending index on c make? Can the database resolve the outer max without totally enumerating all the values of c less than the inner max? Does the explain plan prove or disprove this? Or do you have to infer it from TKPROF IO counts?

"Daniel Morgan" <dmorgan_at_exesolutions.com> wrote in message news:3D908DB2.A32D71FA_at_exesolutions.com...
> Brian E Dick wrote:
>
> > select max(c) from (select c from t where c < (select max(c) from t))
> >
> > "abhishek" <singhhome_at_yahoo.com> wrote in message
> > news:e52380ab.0209232324.24bd2cbd_at_posting.google.com...
> > > how to write sql querry to
> > > 1. show the second maximum value of a column.
>
> Fascinating. I like it.
>
> Now to explain plan them all.
>
> Thanks everyone for the material. My students, in a few weeks, will thank
> you too. (I think)
>
> Daniel Morgan
>
Received on Tue Sep 24 2002 - 14:33:29 CDT

Original text of this message

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