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 / meher

Let the table name is EMP

To find 101st row the query is as below:

select * from EMP where rownum <= 101
minus
select * from EMP where rownum <= 100;


for Nth salary the query is as below:

SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT
(DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we use ddl statements in stored procedure?

881


How much does sql cost?

735


What are the benefits of triggers?

893


what is query cache in mysql? : Sql dba

762


Explain lock escalation? : Transact sql

867






Is mariadb nosql?

765


what is the difference between mysql_fetch_object and mysql_fetch_array? : Sql dba

732


What is the difference between nvl function, ifnull function, and isnull function?

797


Can we rollback truncate?

719


what is the use of friend function? : Sql dba

727


How to fetch values from testtable1 that are not in testtable2 without using not keyword?

958


Explain spool.

904


What is sap sql anywhere?

680


What is the usage of when clause in trigger?

759


what is the difference between a local and a global temporary table? : Sql dba

741