SQL> select * from taj order by sal desc;
NAME SAL
-------------------- ----------
CEO 10000
MANAGER 8000
IT MANAGER 7000
PROGRAMMER 5000
SALESMAN 3000
SALESMAN 3000
OFFICEBOY 1000
OFFICEBOY 1000
8 rows selected.
Note: Select 6th hightest salary
SQL> select * from (
2 select name,sal,rownum rn from taj where rownum < 7)
3 where rn = 6;
NAME SAL RN
-------------------- ---------- ----------
OFFICEBOY 1000 6
"Teach Oracle Learn Oracle" -- Taj Contact me for support at askdbataj@gmail.com This blog is dedicated to all ORACLE Professionals and Learning Students.
Search This Blog
Thursday, June 28, 2007
Retrieve only the Nth row from a table
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment