how will I find the first 5 highest salaried employees in
each dept in oracle.

Answer Posted / murali mohan

Try This,

select empno,deptno,sal,dense_rank from (SELECT empno,
deptno,sal,
DENSE_RANK() OVER (PARTITION BY
deptno ORDER BY sal DESC NULLS
LAST) DENSE_RANK
FROM emp) tmp
where dense_rank<=5;

Regards,
Murali

Is This Answer Correct ?    21 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between pre-select and pre-query

565


State the difference between a primary key and foreign key?

508


How to shutdown your 10g xe server?

608


how to join query for one source type is oracle another source type is sql server ?

1979


What is a dynamic performance view in oracle?

596






What are internal user account in oracle?

567


Describe the types of sub query?

543


How to use "while" statements in oracle?

729


What is the usage of analyze command in oracle?

609


while i take backup using ibm tsm the following errors occurred: rman-03009 ora-19513 ora-27206 ora-19502 ora-27030 ora-ora19511

3862


Why is oracle database so popular?

559


Why do I get java.lang.abstractmethoderror when trying to load a blob in the db?

549


What is the use of oracle?

543


Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.

1525


what are steps for interface? where is exchange rate defined in which table?

1485