Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select the first n rows of a table

Status
Not open for further replies.

kathalena

Technical User
Joined
Jun 22, 2002
Messages
3
Location
AT
which function lets me select the first n rows of a table (oracle, sqlplus)? and which one selects the 2nd row (for example)?

i didn't find any function for that query...

thanks, kathalena

 
e.g.
To select first 4 rows from STUDENTS table.
SQL> select id from students where rownum < 5;
ID
----------
10000
10001
10002
10003

To select 2nd row from the same query
SQL>(select id from stds where rownum < 3 )
minus
(select id from stds where rownum < 2 );
ID
----------
10001

Hope this helps.

-Vikram
 
THANKS a lot!! it works!

kathalena
 
thanks a lot, it works!

kathalena
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top