how to find nth highest salary
Answer Posted / deven
<font color="Green" >This is long method but it works</color>
<font color="red" >step 1(this will make salary in
ascending order)</color>
<font color="blue" >create index Ind_sal on emp(salary)</color>
<font color="red" >step 2(to calculate Nth highest salary
where N=1,2,3,4.....)</color>
<font color="blue" >select distinct top N salary from emp
except
select distinct top N-1 salary from emp
</color>
<font color="red" >in some databases 2nd step may be</color>
<font color="blue" >
select distinct top N salary from emp
minus
select distinct top N-1 salary from emp</color>
Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
How does normalization work?
Explain what you mean by 3 tier architecture.
What is indexing in sql server with example?
How to connect to a sql server using odbc_connect()?
What program is used to store the data source file?
Why use triggers?
Explain what is use of dbcc commands?
What are the types of resultset?
What is difference between rownum and row_number?
What are the different subsets of sql?
What are page splits? : SQL Server Architecture
SQL Server Architecture ?
What are the benefits and tasks of object explorer? : sql server management studio
What is report snapshot in ssrs?
What is the downside of using udf?