adspace


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

Can we rollback truncate?

1074


Is primary key always clustered index?

1095


Hi am new to PLSQL & facing problems in writing code like in SP, Functions, so any one having some SP coding with in depth explanation please share with me my Email ID suvarnaatsuvarna@rediffmail.com Or taking tanning on this please do contact me

2091


what are the advantages of sql ? : Sql dba

1142


what is dbms? : Sql dba

1061


what are all the common sql function? : Sql dba

1131


Is primary key clustered index?

1019


what is schema? : Sql dba

1147


Can we use distinct and group by together?

1133


how to use regular expression in pattern match conditions? : Sql dba

1113


how to escape special characters in sql statements? : Sql dba

1114


Is inner join faster than left join?

1277


What is the current version of postgresql?

1178


how to start mysql server? : Sql dba

1267


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

1056