If u have a table with columns empid,empname,salary, Write a query to get maximum 5 salary drawing employees?

This question is related to Oracle Interview

Showing Answers 1 - 4 of 4 Answers

kranthi

  • Dec 1st, 2005
 

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

  Was this answer useful?  Yes

pktelango

  • Jan 19th, 2006
 

5th MAX Salary

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

  Was this answer useful?  Yes

Praveen Kumar M

  • Apr 11th, 2006
 

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

  Was this answer useful?  Yes

nirav

  • Jul 21st, 2006
 

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

where n is the nth highest salary you want.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions