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
what is foreign key? : Sql dba
Can we debug stored procedure?
What is the difference between delete, truncate and drop command?
how to include numeric values in sql statements? : Sql dba
What can sql server reporting services do?
what is the difference between delete and truncate commands? : Sql dba
what is a composite key ? : Sql dba
What are schema-level triggers?
What is the need of merge statement?
What will you get by the cursor attribute sql%rowcount?
What is graph sql?
how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba
Is microsoft sql free?
What is the order of sql select?
what is the maximum length of a table name, database name, and fieldname in mysql? : Sql dba