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 / prativa mishra

select *
from
(select salary,dense_rank() over (order by salary) kk from table_name)
where kk=2

Is This Answer Correct ?    5 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are hotfixes and patches?

527


What is the difference between microsoft sql and mysql?

512


What is the difference between the implicit and explicit cursors?

525


What is trigger in pl sql?

561


Do foreign keys improve performance?

545






What is difference between joins and union?

531


what are the type of locks ? : Sql dba

528


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

597


What is using in sql?

565


Is delete faster than truncate?

547


What are secondary keys?

561


How is a process of pl/sql compiled?

599


Inline the values in PL/SQL, what does it mean.?

628


What is sp_helptext?

590


Is big data nosql?

513