Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

What is the simplest tool to run commands on oracle servers?

954


Explain the use of file option in exp command.

1078


What is Java Pool in Oracle?

1088


List the various oracle database objects?

993


what is the need of indexing topic in oracle? where do we use in a Java project? any other option other than using this to get the same result where we use indexing ?

2411


What is an index associated with a constraint?

973


How many types of segments in Oracle?

1011


Which is faster join or subquery in oracle?

931


What is the difference between PFILE and SPFILE in Oracle?

993


What is recovery manager(rman) backup in Oracle?

1124


How to apply filtering criteria at group level in oracle?

985


Differentiate between translate and replace?

1036


What is the difference between a primary key & a unique key?

1036


How do I know if oracle is installed on windows?

876


How many data types are supported?

1019