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 to insert a record into a table?

1076


What is rich query?

985


What is PL/SQL ?

2080


1) Does oracle have any table which contain all the exceptions and it's code internally?

1754


How to execute a stored program unit?

1083


Explain the use of ignore option in imp command.

1041


What is a dynamic performance view in oracle?

998


Give the constructs of a package, function or a procedure.

1052


What are the logical operations?

1128


Explain the use of owner option in exp command.

1049


What is Virtual Private Database in Oracle?

1092


How to list all tables in your schema?

1055


Why do we need integrity constraints in a database?

1027


How can I see all tables in oracle?

1011


What privilege is needed for a user to create tables in oracle?

953