Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: TOP N syntax in Oracle 9i.
Sybrand,
Thank you for the clues!
Query on tahiti in "SQL Reference" yields the following results: Word or phrase Results
=========================== =================== "select" matched 497 topics. "select AND rows matched 93 topics. "select AND first AND rows" matched 18 topics. "select AND rownum" matched 5 topics. "select AND top" matched 9 topics. "select AND top-N" matched 1 topic (ROWNUM).
Rownum had the following as a part of it:
> If you embed the ORDER BY clause in a subquery and
> place the ROWNUM condition in the top-level query,
> you can force the ROWNUM condition to be applied
> after the ordering of the rows. For example, the
> following query returns the 10 smallest employee
> numbers. This is sometimes referred to as a "top-N query":
>
> SELECT * FROM
> (SELECT * FROM employees ORDER BY employee_id)
> WHERE ROWNUM < 11;
For those of us who are NOT Oracle guru's, please include a buzz word to assist searches. Some users may have jargon from other databases or just not remember a synonym. The person could wind up with "RANK" or some other thing that is not quite what was hoped for.
I have struggled with "jargon conversion" for a few months now, so I try to search before I ask the question, but sometimes it can not be done without a pointer in the right direction.
Thanks,
Evan
Sybrand Bakker wrote:
>
> On Mon, 29 Apr 2002 15:58:01 +0200, "Đuro Dretvić"
> <Djuro.Dretvic_at_Infodom.hr> wrote:
>
> >Greetings !!!
> >
> >How do I retrieve first N rows from table or view in Oracle 9i ?
> >
> >Example of T-SQL in MS SQL Server 2000.
> >
> >N= 20
> >
> >SELECT TOP 20 FROM DEPT;
> >
> >Regards Dj.
> >
>
> http://tahiti.oracle.com has all 9i docs including the sql reference
> manual. The paragraph on SELECT would typically contain the correct
> answer.
> Or is this a quiz question, where the correct responder earns
> something?
> I don't think so, you are probably just too lazy to type the URL
>
> Please do your homework the next time before asking mere doc
> questions.
>
> Regards
>
> Sybrand Bakker, Senior Oracle DBA
>
> To reply remove -verwijderdit from my e-mail address
Received on Mon Apr 29 2002 - 12:34:14 CDT