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...

i need department wise top 2 employees salary.which logic
i will use

Answer Posted / ashok kumar y

SELECT a.deptno, a.sal
FROM (SELECT deptno, sal,
DENSE_RANK () OVER (PARTITION BY deptno ORDER BY sal DESC NULLS LAST) max_sal
FROM emp
WHERE deptno IS NOT NULL) a
WHERE max_sal <= 2 group by deptno,sal ;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is sql*plus?

1196


Does a user_objects view have an entry for a trigger?

1049


How you improve the performance of sql*loader? : aql loader

1063


Why do we go for stored procedures?

1126


Show the two pl/sql cursor exceptions.

1260


What is the function that is used to transfer a pl/sql table log to a database table?

1068


What is a unique key?

1105


What are sql procedures?

1085


What is cursor and its types?

1151


What are triggers and its uses?

1095


Can we use joins in subquery?

1226


Which command is used to delete a trigger?

1407


Explain the insert into statements in sql?

1053


What is ttitle and btitle?

1113


Can you select everything, but 1 or 2 fields, without writer's cramp?

1039