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

Answer Posted / shyam

select * from
(select ename,job,sal,deptno,
dense_rank()
over(partition by deptno order by sal desc) densrank
from emp)
where densrank<=2;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by stored procedures?

555


Does truncate require commit?

548


What is difference between joins and union?

535


Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?

554


how to write date and time literals? : Sql dba

536






How do I add a database to sql?

584


What is difference between sql and excel?

519


Which normal form is best?

520


Can I join the same table twice?

531


What is primary key sql?

548


Can a table contain multiple primary key’s?

631


what's the difference between a primary key and a unique key? : Sql dba

514


Explain constraints in sql?

575


How do I audit the sql sent to the server?

530


what is subquery? : Sql dba

576