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


Please Help Members By Posting Answers For Below Questions

What is sql profiler in oracle?

568


List and explain the different types of join clauses supported in ansi-standard sql?

827


what are the 'mysql' command line options? : Sql dba

561


What is the difference between Union and Union all. Which is faster.

846


Which is faster view or stored procedure?

507






Explain what is a field in a database and record in a database?

612


What is cartesian join in sql?

559


What is a mutating table and a constraining table?

575


Is it possible to update views?

542


What are character functions in sql?

500


what is 'mysqld'? : Sql dba

546


what is a view? : Sql dba

638


Name three sql operations that perform a sort.

593


How to select unique records from a table?

571


What is interval partition?

546