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
Can we rename a column in the output of sql query?
What is an index? What are the types of indexes? How many clustered indexes can be created on a table?
What is the use of stored procedures?
How to test for null values?
What are the two types of exceptions in pl/sql?
How is debugging done?
How do I audit the sql sent to the server?
What is a constraint?
What is difference between stored function and application function?
can sql servers linked to other servers like oracle? : Sql dba
Is sql better than excel?
What is database sql?
What does inner join mean?
What is query optimization in sql?
Explain the structure of pl/sql in brief.