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 / m.raghu

answer for 101th record

select * from emp where empno in( select decode
(rownum,&n,empno) from emp);

for 4th highest sal

select distinct sal from(select empno,dense_rank() over
(order by sal desc) rnk from emp) where rnk=&n;

for 5th highest sal give n value=5
for 1-10

select distinct sal from(select empno,dense_rank() over
(order by sal desc) rnk from emp) where rnk<=&n;

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are all the common sql function? : Sql dba

1141


Does group by remove duplicates?

1120


Can we rollback truncate?

1083


what is dbms? : Sql dba

1070


define sql insert statement ? : Sql dba

1108


what is sql server agent? : Sql dba

1188


what is schema? : Sql dba

1163


How do I remove duplicates in two columns?

1202


Is inner join faster than left join?

1287


how to start mysql server? : Sql dba

1279


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

1155


What is the current version of postgresql?

1188


Is primary key clustered index?

1027


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

1065


Do we need to rebuild index after truncate?

1151