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 are all the different normalization?

744


how to increment dates by 1 in mysql? : Sql dba

724


how is myisam table stored? : Sql dba

782


How many sql statements are used?

743


What is difference between sql and excel?

696






what are date and time intervals? : Sql dba

760


Which constraints we can use while creating database in sql?

790


How show all rows in sql?

799


difference between anonymous blocks and sub-programs.

818


What are the different types of tables in sql?

659


What does count (*) mean?

682


What can you do with pl sql?

769


How to get unique records from a table?

682


Does sqlite need a server?

737


Is a view faster than a stored procedure?

713