How to retrieve a second highest salary from a table?
Note:Suppose salaries are in duplicate values
eg:
Name Sal
Malli 60000
Pandi 60000
Rudra 45000
Ravi 45000

Answer Posted / ashok

select sal from emp order by sal desc offset 1 rows fetch next 1 rows with ties;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is lexical units in pl sql?

565


what is data manipulation language? : Sql dba

525


Can we use having without group by in sql?

543


What is the left table in sql?

511


What is the reports view in oracle sql developer?

535






Can we want to pass a parameter payroll_id to this external pl/sql function, how do we do it?

545


How to use sql*plus built-in timers?

569


What action do you have to perform before retrieving data from the next result set of a stored procedure ?

2084


What is the purpose of cursors in pl/sql?

631


How many times can we commit in a loop?

560


What is trigger and how to use it in sql?

529


What are the benefits of pl/sql packages?

537


Explain clause in sql?

552


Can there be 2 primary keys in a table?

550


What is scalar function?

560