Click here to Skip to main content
13,088,101 members (47,373 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
write a query to select the 5th higest salary record from table employee
plz explain the query too
Posted 20-Sep-12 1:47am
Comments
Wes Aday 20-Sep-12 7:48am
   
Uhm.... no.... do your own homework and you would be able to explain it yourself.
Member 9239619 20-Sep-12 7:50am
   
i have an interview tomorrow so m asking
Malli_S 20-Sep-12 7:52am
   
Then better you should have googled. Or should have referred to some reference book. Why wasting time here.
vithal wadje 20-Sep-12 7:51am
   
gud gud best of luck i will reply
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 4

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
  Permalink  
Comments
vithal wadje 20-Sep-12 8:20am
   
great vijay sir
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You can simply use the Tophttp://msdn.microsoft.com/en-us/library/ms189463.aspx[^] keyword.
However, that is not the solution the interviewer would most likely be looking for.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web03 | 2.8.170813.1 | Last Updated 20 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100