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 / sreeharibabu

SELECT id
FROM (select salary2.*, rownum rnum from
(select * from test ORDER BY id DESC) salary2
where rownum <=2 )
WHERE rnum >= 2;

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 meant by temporal data?

546


What are sql procedures?

582


What is the difference between a database and a relational database?

560


How to take user input in pl sql?

705


What is restrict in sql?

556






What is the process of copying data from table a to table b?

598


Is oracle sql free?

540


What does where 1/2 mean in sql?

532


How does postgresql compare to mysql?

576


Is sql harder than python?

608


What is composite primary key in sql?

524


Why is sql important?

577


How do I run a pl sql program?

629


What is a ddl command?

534


What is the difference between syntax error and runtime error?

612