how will I find the first 5 highest salaried employees in
each dept in oracle.
Answers were Sorted based on User's Feedback
Answer / sunil panghal
select rownum as row_id,salary from (select salary from
employees order by salary) where rownum <6;
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / rammohan
select rownum as row_id,sal from (select sal from
emp order by sal desc) where rownum <6;
| Is This Answer Correct ? | 1 Yes | 2 No |
Answer / uttam
select sal from (SELECT distinct sal FROM emp order by sal
desc)
where rownum <6
| Is This Answer Correct ? | 13 Yes | 15 No |
Answer / manjusure@yahoo.co.in
select * from emp e where 5> (select count(max(sal)) from emp
where e.deptno=deptno and sal>e.sal group by sal);
| Is This Answer Correct ? | 4 Yes | 6 No |
Answer / mihir nasikkar
select *
from employee X
where salary in (select top 5 salary
from employee
where dept = X.dept
order by salary desc)
order by dept, salary desc
| Is This Answer Correct ? | 2 Yes | 4 No |
Answer / mangesh
SELECT * FROM (SELECT * FROM EMP ORDER BY SALARY desc) WHERE ROWNUM < 6;
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / md valiyullah
select max(sal)-5 from emp where dept = 'sale'
union all
select max(sal)-5 from emp where dept = 'purchase'
| Is This Answer Correct ? | 0 Yes | 4 No |
Answer / dhanalakshmi
select salary
from employee
where rownum<6
group by deptno,salary
order by salary desc
| Is This Answer Correct ? | 0 Yes | 9 No |
5. Display full details for the creditor/s who has received the single largest payment. Do not use a table join or set operator anywhere in your query.
What is the usage of synonyms?
What are a cluster and non-cluster index?
Give the different types of rollback segments.
Please HELP me its urgent? If i want to EXPORT data from SQL server to ORACLE 11g then how can I replicate data from SQL to ORACLE?
what are views?
Whether any commands are used for months calculation? If so, what are they?
How many data types are supported?
Explain the blob datatype?
In Oracle Applications We are Using Sub Ledger Accounting. When we Transfer the Data all modules (AP,AR,CE,FA) to SLA We done Some customizations? What are They??
how to insert data into partitioned table partition done by Range partition
hi friends i completed b.com 2004.i have 3y accounting exp. in manufacturing company.now i have completed oracle finance.pls suggest me how will get job in oracle.can i get job in oracle.