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

SELECT * FROM (
SELECT RANK()OVER( ORDER BY SALARY DESC) NUM, A.* FROM RAJ A)
WHERE NUM=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 are the ddl commands?

718


what are the features and advantages of object-oriented programming? : Sql dba

727


how to get @@error and @@rowcount at the same time? : Sql dba

741


What are different types of tables in sql?

700


Is postgresql a server?

736






What is an exception in pl/sql?

725


How does left join work in sql?

700


How does stored procedure reduce network traffic?

732


can sql servers linked to other servers like oracle? : Sql dba

750


Why is sql better than hql?

688


what is an execution plan? When would you use it? How would you view the execution plan? : Sql dba

728


What is difference between function and trigger?

719


what is a unique key ? : Sql dba

764


Explain select statements in sql?

759


What are the types of functions in sql?

745