编写一个 SQL 查询,获取 Employee
表中第二高的薪水(Salary) 。
Mysql写法:
1 | Select IFNULL((select distinct(Salary) as SecondHighestSalary from Employee order by Salary desc limit 1,1),null) AS SecondHighestSalary |
SQL写法:
1 | select Max(Salary) as SecondHighestSalary from Employee WHERE Salary<(select Max(Salary) from Employee) |