adspace


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

How do I remove duplicates in two columns?

1202


how many tables will create when we create table, what are they? : Sql dba

1155


how to start mysql server? : Sql dba

1279


What is the current version of postgresql?

1188


what is bcp? When does it used? : Sql dba

1065


what is collation? : Sql dba

1242


what are aggregate and scalar functions? : Sql dba

1142


If a cursor is open, how can we find in a pl/sql block?

1252


what are the advantages of sql ? : Sql dba

1154


Is inner join faster than left join?

1287


define sql insert statement ? : Sql dba

1108


what is schema? : Sql dba

1163


what is dbms? : Sql dba

1070


Can we use distinct and group by together?

1146


Can delete statement be rollbacked?

1065