Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: SQL DBMS
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 at 20-Sep-12 7:48am
   
Uhm.... no.... do your own homework and you would be able to explain it yourself.
Member 9239619 at 20-Sep-12 7:50am
   
i have an interview tomorrow so m asking
Malli_S at 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 at 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 at 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
0 OriginalGriff 373
1 Sergey Alexandrovich Kryukov 197
2 Richard Deeming 160
3 PhilLenoir 120
4 RyanDev 115
0 Sergey Alexandrovich Kryukov 6,405
1 OriginalGriff 5,798
2 CPallini 2,473
3 Richard MacCutchan 1,647
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 20 Sep 2012
Copyright © CodeProject, 1999-2014
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