Re: Re: First impressions: 10 features not in Oracle

From: Kevin Fries <kelfink_at_ecst.csuchico.edu>
Date: 1995/11/06
Message-ID: <47lkon$gv6_at_charnel.ecst.csuchico.edu>#1/1


In article <9511041954.aa04862_at_florin.florin.msk.su>, Dmitry M. Potapov <dima_at_florin.msk.su> wrote:
>Craig Sivils writes:
>->
>-> dlv_at_bwalk.dm.com (Dr. Dimitri Vulis) wrote:
>->
 

>-> >5. It would be helpful to be able to select the numeric rank of ordered data
>-> >as a pseudocolumn:
>->
>
>select rownum from table1 order by table1_attr;
>
>rownum is a pseudocolumn you need.
>
>Dmitry Potapov, dima_at_florin.msk.su
>--
>

Ouch! Hold on a sec. That's going to give someone very disappointing results.

Rownum is calculated prior to any order-by's, or group by's.

It will not do what you suggest, unless (and only MAYBE then) your entire table is fetched in order form the disk-- which would mean that the whole order by was technically unnecessary.

If you create a simple table (1 column) of numerics, you can see results similar to the following:

SQL> select rownum, col1 from orderby order by col1;

    ROWNUM COL1
---------- ----------

         5          1
        10          2
         7          3
         9          4
         2          5
         6          6
         3          7
         4          8
         8          9
         1         10

-- 
-------------------------------------------------------------
Kevin Fries                         kelfink_at_ecst.csuchico.edu
Developer/DBA           http://www.ecst.csuchico.edu/~kelfink
Received on Mon Nov 06 1995 - 00:00:00 CET

Original text of this message