编写查询以选择表员工的第5个最高薪水记录 [英] write a query to select the 5th higest salary record from table employee
本文介绍了编写查询以选择表员工的第5个最高薪水记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
编写查询以从表employee中选择第5个最高薪水记录
请也解释查询
write a query to select the 5th higest salary record from table employee
plz explain the query too
推荐答案
请查看以下文章并进行审查.我希望你能得到答案.
^ ]
谢谢,
Viprat
Hi,
Please see the below article and review it. i hope you will get answer.
http://blog.sqlauthority.com/2008/04/02/sql-server-find-nth-highest-salary-of-employee-query-to-retrieve-the-nth-maximum-value/[^]
Thanks,
Viprat
尝试这个解决方案.我试过了,
try this soln.it works i haved trid
select * from
(select empId,salary,RANK() over (order by salary desc) as rank from Emp ) as p
where rank=5
您可以简单地使用Top
http://msdn.microsoft.com/en-us/library/ms189463.aspx [
You can simply use theTop
http://msdn.microsoft.com/en-us/library/ms189463.aspx[^] keyword.
However, that is not the solution the interviewer would most likely be looking for.
这篇关于编写查询以选择表员工的第5个最高薪水记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文