how to findout the 100th maximum salary

Answer Posted / srinu

Hi Jyothi,

The below q uery is suitable for Nth max salary....

SELECT a.sal
FROM emp a
WHERE &N=(SELECT COUNT(DISTINCT b.sal)
FROM emp b
WHERE a.sal<=b.sal);
In the above query u can substitute any value like 1,2,..100 etc instead of &n.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we use procedures in sql?

554


Why is sql*loader direct path so fast?

604


Why cross join is used?

637


what are tables and fields? : Sql dba

584


What is trigger price?

546






How do you take the union of two tables in sql?

517


What is function and procedure in pl sql?

523


What are sql queries used for?

540


What is audit logout in sql profiler?

592


Is json a nosql?

544


what does it mean to have quoted_identifier on? What are the implications of having it off? : Sql dba

532


What is int identity in sql?

576


How do I view a sql trace file?

570


How do I remove sql developer from windows 10?

511


What is a temp table?

571