how to find nth highest salary
Answer Posted / sysdomain
'top' will fetch only top most : ie top 5 means it will
fetch first 5 rec. After fetching rec only 'order by' is
done ie sorting is done after fetching. therefore using
'top' and 'order by' alone wont get max or min value. for
that we have to use 'distinct' before 'top' (which will sort
the records before fetching).
select top 1 salary from employee where salary in (select
distinct
top n salary from employee order by salary desc)
| Is This Answer Correct ? | 7 Yes | 16 No |
Post New Answer View All Answers
What is built-in/administrator?
how do you determine the Load performance of any query in sql server {example how do u determine performance of a select stmnt which returns Dynamically many no of records ... some times 100,1000,10000 etc., }
What is the importance of three tier architecture?
Why is normalisation important?
What is the use of custom fields in report?
Can you please explain the difference between function and stored procedure?
What's the information that can be stored inside a bit column?
What are the events recorded in a transaction log?
What is the usage of sign function?
Does dbcc checkdb requires db to be in single_user mode? : sql server database administration
How efficient you are in oracle and SQL server?
How many replicas are maintained for each sql azure db?
What is store procedure? When do you use?
What is the maximum size per database for sql server express?
You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?