suppose we have a table in which 200 rows. i want to find
101 row ? what the query....
and how we find 4th and 5th highest salary and 1 to 10
highest salary

Answer Posted / priya

Here It is asked for 101 row. It does not mean ascending or
descending order.
So query goes like this

Ans:select * from emp where rowid in(
select max(no) from
(select rowid as no,sal from emp where rownum<102));

To Find the 101th row higest salary
Ans:
select max(sal) from (
select * from emp order by sal) s where rownum<102;

similarly for 4th highest it is 5 and for (n-1)th sal it is
n.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a primary key sql?

565


how to get a list of columns in an existing table? : Sql dba

544


Why is sql better than hql?

510


How do I sort a table in sql?

599


What are some predefined exceptions in pl/sql?

552






Why is theta join required?

664


how is myisam table stored? : Sql dba

607


Define a temp table?

553


How many types of functions are there in sql?

506


How many rows can sqlite handle?

587


What is the limitation on the block size of pl/sql?

532


What is sql clause?

543


What are the types of triggers in sql?

501


What program will open a mdb file?

502


Do ddl statements need commit?

540