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

Can I create table without primary key?

937


How does sql*loader handles newline characters in a record? : aql loader

984


Explain clause in sql?

958


which types of join is used in sql widely? : Sql dba

928


How do I add a database to sql?

1062


What is sql entity?

1029


How to select unique records from a table?

998


How do I view a table in sql?

947


Define commit, rollback and savepoint?

976


What is thread join () in threading?

944


What are the string functions in sql?

922


what are the system privileges that are required by a schema owner (user) to create a trigger on a table?

1001


What is sp_helptext?

1004


How does cross join work?

874


Is pl sql and postgresql same?

1052