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

How many aggregate functions are available there in sql?

526


What are the different types of joins in sql?

579


Write a query to find the names of users that begin with "um" in sql?

499


What is sql query optimization?

541


What is procedure function?

537






Can we rollback after truncate?

561


What is trigger in pl sql with examples?

519


What is restrict in sql?

554


What is sqlerrm?

542


How do I run a sql script?

510


can sql servers linked to other servers like oracle? : Sql dba

548


what are the performance and scalability characteristics of mysql? : Sql dba

525


how to select first 5 records from a table? : Sql dba

507


what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba

569


How do you get column names only for a table (sql server)?

663