Second Highest Salary

后端 未结 10 1531
无人共我
无人共我 2020-12-20 06:14

Write a SQL query to get the second highest salary from the Employee table.

    | Id | Salary |
    | 1  | 100    |
    | 2  | 200    |
    | 3  | 300    |
<         


        
10条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-20 07:08

    Here is the easy way to do this

    SELECT MAX(Salary) FROM table WHERE Salary NOT IN (SELECT MAX(Salary) FROM table);
    

提交回复
热议问题