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
which operator is used in query for pattern matching? : Sql dba
What is Histogram?
Describe different types of general function used in sql?
how is exception handling handled in mysql? : Sql dba
Why we use triggers in mysql?
Are stored procedures faster than queries?
what are the different functions in sorting an array? : Sql dba
Which is better varchar or nvarchar?
Show the two pl/sql cursor exceptions.
What is a schema sql?
Define sql delete statement.
Define implicit and explicit cursors.
what happens if null values are involved in expressions? : Sql dba
What does inner join mean?
How does sql store data?