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
can an order by clause be used in a creation of a view?
explain different types of joins? : Sql server database administration
what is a self join? Explain it with an example? : Sql server database administration
What is a View ? Can we insert, Update and delete a view?
What are “phantom rows”?
What is sql service broker?
How to trouble shoot if unable to connect SQL Server
How to delete a login name in ms sql server?
What is fill factor and pad index?
What is the difference between varchar and varchar types?
How is table type constraint applied to a table?
What is an index. What are the types?
What is BCNF? How is it better than 2NF & 3NF?
Explain the xml support sql server extends?
If you want to send some data from access database to sql server database. What are different component of ssis will you use?