+ - + -- -- -- -- -- -- -- -- +
| | Id Salary |
+ - + -- -- -- -- -- -- -- -- +
| | 100 | 1
200 | | 2 |
300 | | 3 |
+ - + -- -- -- -- -- -- -- -- +
To find out the second highest salary, thank you!
CodePudding user response:
select id, salary
The from (select id, salary, dense_rank () over (order by salary desc) rank the from table name)
Where rank=2;
Look at your output, however, don't feel like oracle, don't know doesn't support this analysis function,
CodePudding user response:
SELECT * FROM TOP 1 (
SELECT the TOP 2 * FROM the TAB ORDER BY Salary DESC
) AS a ORDER BY Salary
Oracle should also support this way
CodePudding user response: