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
Does a primary key have to be a number?
what are the advantages of sql ? : Sql dba
How do I tune a sql query?
how does a local variable is defined using t-sql? : Transact sql
What is primary key secondary key alternate key candidate key?
Why is pl sql used?
explain the difference between bool, tinyint and bit. : Sql dba
Why do we use procedures in sql?
what is a record in a database ? : Sql dba
What packages are available to pl/sql developers?
What is data manipulation language?
Is it possible to create the following trigger: before or after update trigger for each row?
Is json a nosql?
What is a sql*loader control file?
What is a heap in sql?