GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Placement Papers  >  Oracle  >  Java
Go To First  |  Previous Question  |  Next Question 
 Java  |  Question 61 of 134    Print  
If u have a table with columns empid,empname,salary, Write a query to get maximum 5 salary drawing employees?

  
Total Answers and Comments: 4 Last Update: July 21, 2006   
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
December 01, 2005 08:37:51   #1  
kranthi        

RE: If u have a table with columns empid,empname,salar...

select * from (select * from emp order by sal desc) where rownum < 5;


 
Is this answer useful? Yes | No
January 19, 2006 06:36:34   #2  
pktelango Member Since: January 2006   Contribution: 3    

RE: If u have a table with columns empid,empname,salar...

5th MAX Salary

select max(SALARY) from EMP A where 5 ( select count(distinct(SALARY)) From EMP B where B.ID> A.ID)


 
Is this answer useful? Yes | No
April 11, 2006 07:12:51   #3  
Praveen Kumar M        

RE: If u have a table with columns empid,empname,salar...

SELECT empid
empname
salary
RANK() OVER (ORDER BY salary DESC) AS Rank_Salary
FROM emp
QUALIFY Rank_Salary< 3;


 
Is this answer useful? Yes | No
July 21, 2006 08:14:06   #4  
nirav        

RE: If u have a table with columns empid,empname,salar...

select min(sal) from (select sal from emp order by sal desc) where rownum < n;

where n is the nth highest salary you want.


 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape