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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: ROWNUM -- HOW ARE ROWS SELECTED?

RE: ROWNUM -- HOW ARE ROWS SELECTED?

From: MaryAnn Atkinson <maryann_30_at_yahoo.com>
Date: Wed, 09 Jul 2003 08:53:44 -0700
Message-ID: <F001.005C414F.20030709084449@fatcity.com>


Its obvious I hadnt fully understood ROWNUM yet, as you see we are learning bits and pieces as we go along.

Help me out here, will you? Talk to me like I'm a 10-year old, its ok.

> MaryAnn, the best way to understand rownum is to do the following:
>
> SQL> SELECT ROWNUM, GENDER
> 2 FROM (SELECT ROWNUM, GENDER
> 3 FROM EMP2
> 4 WHERE ROWNUM <= 20)

> You will quickly see that, no matter how you order the result set,
> the first record returned is rownum #1, second is rownum #2 etc.
> The rownum value is assigned as rows are RETURNED or DISPLAYED,
> not as they are selected.

Fine, the rows are numbered as returned or displayed(not selected).

BUT THEN HOW ARE THEY SELECTED? My emp2 table has 10000+ rows in it, how are only 20 selected? Based on what criteria? How do I get 20 back?

I want to understand this first.

Then, once I get these 20 back, then fine, they are numbered starting from 1, that part I kind of figured it out, or so I think.

The part I dont get, is HOW ARE THEY SELECTED?

thx
maa



Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month! http://sbc.yahoo.com
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: MaryAnn Atkinson
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Jul 09 2003 - 10:53:44 CDT

Original text of this message

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