i need department wise top 2 employees salary.which logic
i will use
Answer Posted / manish gupta
select deptno,sal from (select * from emp order by sal
desc) where rownum<3
union
select deptno,sal from (select * from emp order by sal
desc) where rownum<3 and deptno not in(20);
considering scott table in db.
| Is This Answer Correct ? | 0 Yes | 1 No |
Post New Answer View All Answers
What is primary and foreign key?
explain advantages of myisam over innodb? : Sql dba
Explain foreign key in sql?
What is serial sql?
how can we know the number of days between two given dates using mysql? : Sql dba
What are three advantages to using sql?
How many sectors are in a partition?
What is an invalid partition table?
What is pessimistic concurrency control? : Transact sql
Is clustered index a primary key?
what is the difference between delete and truncate statement in sql? : Sql dba
What is pl sql and why it is used for?
What is %type in pl sql?
what is difference between delete and truncate commands? : Sql dba
How do you optimize a query?