Write a query to find second highest salary of an employee.

Answer Posted / gautam poonia

SELECT sal
FROM (SELECT sal FROM emp
ORDER BY sal desc)
WHERE RowNum<=2
minus
SELECT sal
FROM (SELECT sal FROM emp
ORDER BY sal desc)
WHERE RowNum<=1

Is This Answer Correct ?    17 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is pl sql block structure?

539


Why do we need sharding?

525


Is it possible for a table to have more than one foreign key?

580


What is the purpose of normalization?

531


What is the difference between union and union all command?

544






how is exception handling handled in mysql? : Sql dba

549


What is mdb stand for?

554


Why is %isopen always false for an implicit cursor?

568


How to select unique records from a table?

568


How would you pass hints to the sql processor?

525


Explain 3 basic parts of a trigger.

830


Why we use cross join?

536


How to generate a salary slip like jan 1000 1000 feb 1000 2000 ... dec 1000 12000

1638


Why stored procedure is better than query?

505


What is not in sql?

496