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 / kavitha

SELECT distinct a.department_id, a.salary
FROM (SELECT department_id, salary,
DENSE_RANK () OVER (PARTITION BY department_id ORDER BY salary DESC NULLS LAST) max_sal
FROM employees
WHERE department_id IS NOT NULL) a
WHERE max_sal <= 2

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is blob? : Sql dba

1220


What is sql and its types?

1253


what is denormalization. : Sql dba

1162


What is foreign key sql?

1039


What is the purpose of the partition table?

1089


How much does sql certification cost?

1142


Is left join faster than inner join?

1168


How do I run a query in pl sql developer?

1050


How does a self join work?

1233


What are transaction and its controls?

1089


What is the difference between delete and truncate statement in sql?

1129


How many sectors are in a partition?

1117


What is trigger and stored procedure in sql?

1092


What are %type and %rowtype for?

1107


Explain mutating table error.

1261