Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: TOP N Query
Harpreet Singh wrote:
> I tried the following query
>> SELECT >> id >> FROM >> ( SELECT rownum SEQ, id FROM emp ORDER BY surname) >> WHERE seq BETWEEN 4 AND 11
Ah.. so it does. Hmm.. I was pretty certain that it did not work. Think I got confused with order by vs. top n queries with group by clauses.
Anyway, it does make things simpler seeing that I'm wrong.
The only problem with this approach is that you effectively perform a full table scan each time the query is run (even though only a subset of the result set is returned). Not a nice thing when dealing with a large table.
-- BillyReceived on Wed Dec 11 2002 - 07:07:06 CST