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

Explain alias?

1133


How to use null as conditions in oracle?

1076


How do you find out from the RMAN catalog if a particular archive log has been backed-up?

2117


Use of an integrity constraint is better to validate data. Explain

1038


Does oracle partitioning improve performance?

990


How to bring a tablespace offline?

1055


How to connect to a remote server?

1122


What are transaction isolation levels supported by oracle?

1064


Name the three major set of files on disk that compose a database in Oracle?

1119


what is the scenario where you take the database to NoArchivelog mode?

2325


how to make an oracle object

2352


What is a table index in oracle?

1126


What are the oracle differences between nvl and coalesce

1145


What is Reduced List of Values?

2160


How to select all columns of all rows from a table in oracle?

1052