how to find the second highest salary from emp table?

Answer Posted / mohammed irfan

SELECT sal1 "salary"
FROM (SELECT ROWNUM rownum1 ,sal1
FROM (SELECT sal sal1
FROM emp
ORDER BY sal DESC
)
)
WHERE rownum1=:p_highest;

Note:- 'p_highest' here we can give the number as we want
to display the highest salary.

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is primary key clustered index?

526


What is the difference between a procedure and a function?

499


What is microsoft t sql?

493


What is cursor and its types?

563


What is rank function in sql?

534






What is the difference between sql and t sql?

542


how to drop an existing index in mysql? : Sql dba

543


Does db2 use sql?

515


What are schema-level triggers?

586


what is the use of anchoring object? what r the difference between anchoring object & enclosing object? can any one tell me all the details?

2011


What is the left table in sql?

523


Are pl sql variables case sensitive?

602


What is using in sql?

570


What do you understand by pl/sql packages?

575


Does asenumerable execute the query?

605