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 nosql relational?

926


Is json a nosql?

957


How do I partition a table in sql?

1104


What type of database is cloud sql?

1084


Is stored procedure faster than query?

949


What is the difference between an inner and outer join?

998


What is out parameter used for eventhough return statement can also be used in pl/sql?

1058


What is schema in sql example?

1159


Can we delete column in sql?

1077


How would you pass hints to the sql processor?

968


What does the sign mean in sql?

967


what is a database transaction? : Sql dba

1153


How many types of triggers exist in pl/sql?

1050


Is postgresql a server?

1031


What is sql query optimization?

1089