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 online transaction processing (oltp)? : Sql dba

938


What are sql*plus environment variables?

1032


Is it mandatory for the primary key to be given a value when a new record is inserted?

1140


What are the disadvantages of not performing database normalization?

1097


what are the 'mysql' command line options? : Sql dba

1018


what is bcp? When does it used? : Sql dba

935


What is sql procedures and functions?

956


What is the difference between a procedure and a function?

1013


What is pl sql and why it is used for?

1073


how to create a new table in mysql? : Sql dba

935


How do I add a database to sql?

1064


What is nosql db?

926


Explain raise_application_error.

1044


Is it possible to create startup or shutdown trigger for on-schema?

981


How to display Row Number with Records in Oracle SQL Plus?

993