i need department wise top 2 employees salary.which logic
i will use

Answer Posted / naresh anumolu

SELECT * FROM(SELECT *,DENSE_RANK() OVER(PARTITION BY DEPTNO ORDER BY SAL DESC) AS RANK FROM EMP)A WHERE RANK<3

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What's the difference between inner join and left join?

721


How can you maintain the integrity of your database on instances where deleting an element in a table result in the deletion of the element(s) within another table?

862


Why left join is used in sql?

697


What is a table in a database?

780


Under what condition it is possible to have a page level lock and row lock at the same time for a query? : Transact sql

736






What is primary key and unique key?

759


What are the constraints available in sql?

779


how can we transpose a table using sql (changing rows to column or vice-versa) ? : Sql dba

690


How can I change database name in sql?

699


What does data normalization mean?

716


What does trigger mean in psychology?

708


Is left join same as join?

726


What are different types of indexes?

702


How many triggers can be applied on a table?

672


Can dml statements be used in pl/sql?

772