how to find nth highest salary
Answer Posted / p rem satyam
This is perfect
...............................
select * from emp e1 where (N-1)=( select
count(distinct(e2.sal) from emp e2 where e2.sal > e1.sal)
where N is level of sal. suppose you want 3rd higest sal then
in place u write 3 i.e write (3-1).
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to list all objects in a given schema?
How to convert a numeric expression from one data type to another?
Why does a sql statement work correctly outside of a user-defined function, but incorrectly inside it?
What does REVERT do in SQL Server 2005?
What command do we use to rename a database?
What are the 2 types of classifications of constraints in the sql server?
How to create an identity column?
What is difference between standardization and normalization?
What is outer join in sql server joins?
Explain what is row_number function?
Define msdb database?
What is the main difference between ‘between’ and ‘in’ condition operators?
Mention the differences between sql server and mysql.
What is the user of Primary key?
Explain view in sql server?