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 are primary key and foreign key and how they work?

554


What is mutating error in pl sql?

549


what is the difference between char_length and length? : Sql dba

574


how is exception handling handled in mysql? : Sql dba

553


which tcp/ip port does sql server run on? : Sql dba

517






how is myisam table stored? : Sql dba

605


What is Materialized View? In What Scenario we Use Materialized View?

8526


list out some tools through which we can draw e-r diagrams for mysql. : Sql dba

513


What is the difference between the repeatable read and serializable isolation levels? : Transact sql

530


what are all types of user defined functions? : Sql dba

548


How bulk collect improves performance?

570


Can we rollback truncate?

541


What is hibernate and its relation to sql?

594


What will you get by the cursor attribute sql%rowcount?

549


What is cross join example?

554