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

How would you go about verifying the network name that the local_listener is currently using?

2108


What is the usage of control file in oracle?

1142


Why do we need integrity constraints in a database?

1076


Explain the use of indexes option in imp command.

1261


What is oracle instant client?

1068


Is insert autocommit in oracle?

1131


What privilege is needed for a user to insert rows to tables in another schema?

1057


How do I limit the number of rows returned by an oracle query after ordering?

1224


What are the extensions used by oracle reports?

1089


Explain the difference between a procedure and a function?

1240


How to create a new user account in oracle?

1064


What is connection pool in oracle?

1037


How do you get nicely formatted results from an oracle procedure that returns a reference cursor?

1120


How many data types are supported?

1137


What is the difference between a user and a schema in oracle?

1079