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

Home -> Community -> Usenet -> c.d.o.server -> Re: Top 'N' Analysis

Re: Top 'N' Analysis

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 25 Sep 2003 06:41:15 -0700
Message-ID: <2687bb95.0309250541.53ad2e70@posting.google.com>

Bricklen <bricklen-rem_at_yahoo.comz> wrote in message news:<PQmcb.7737$AC3.228554_at_news2.telusplanet.net>...
> Bricklen wrote:
>
> > fleeting_at_net1plus.com wrote:
> >
> >> I'm studying to get my DBA in Oracle 9i. After I went through the 3
> >> CD's sent to me, I took the first test and found a question that I
> >> never saw on the CD's! It refered to Top 'N' Analysis.
> >>
> >> I tried going through the CD's again just to see if maybe I missed
> >> something, but still cannot find the reference to Top 'N' analysis.
> >>
> >> Can someone give me a head's-up as to what this is? Even better - can
> >> you tell me where on the three CD's I may have missed this?
> >>
> >> Thank you for your help - great group!
> >>
> >> Kevin
> >
> >
> > Take a look for analytic functions at tahiti.oracle.com and
> > asktom.oracle.com lots of info in both places
> >
>
> more specifically, RANK and DENSE RANK functions

A TOP-N query should just be a query to return the first N, say 5, rows based on an ordering condition.

select * from (select * from emp order by ename) where rownum < 6

This would give you the first five employees by alphabetic odering while ordering by salary descending would give you the highest five salaries etc....

This should be what is meant by a Top-N query.

HTH -- Mark D Powell -- Received on Thu Sep 25 2003 - 08:41:15 CDT

Original text of this message

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