编写一个 SQL 查询,获取 Employee 表中第二高的薪水(Salary) 。如果不存在第二高的薪水,那么查询应返回 null。
注意点:
1.ifnull使用,如果参数1不为null返回参数1,否则返回null。
2.distinct记得使用
3.降序排列
4.limit offset使用
5.mysql中的select A;等同于oracle中的select A from dual;
select ifnull(
(select distinct Salary from Employee
order by Salary desc
limit 1 offset 1),null)
as SecondHighestSalary
;