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
Is postgresql a server?
What is difference between cursor and trigger?
What is the example of procedure?
What are the different type of joins in sql?
Which function is used to return remainder in a division operator in sql?
column A column b | output 10 7 | 10 5 8 | 8 7 -9 | 7 3 5 | 5 0 6 | 6 Write a sql query to print such output.
What is sql architecture?
Which is faster union or join?
what is the difference between myisam static and myisam dynamic? : Sql dba
How can use stored procedures in sql?
Is pl sql better than sql?
What is a variable in sql?
What is pl/sql table? Why it is used?
how to get a list of columns in an existing table? : Sql dba
What is cte?