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

Is join an inner join?

981


What is foreign key in sql with example?

943


Is sql scripting language?

1058


How do I view a view in sql?

956


How does join work in sql?

1015


Can we perform dml in function?

1072


What is the difference between having clause and where clause?

1067


Which one is better subquery or joins?

1069


Is sqlite thread safe?

1058


what are the differences between require and include, include_once and require_once? : Sql dba

1029


How many types of primary keys are there?

1041


what is 'mysqldump'? : Sql dba

1114


What is rename command in sql?

1040


How to connect a sql*plus session to an oracle server?

1134


What is parameter substitution in sql?

1035