语言:sql
v1:
select Salary as SecondHighestSalary from Employee order by Salary desc limit 1,1
结果:未通过,因为为空时,和期待的结果null不同
v2:
SELECT (SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT 1,1) as SecondHighestSalary;
语言:sql
v1:
select Salary as SecondHighestSalary from Employee order by Salary desc limit 1,1
结果:未通过,因为为空时,和期待的结果null不同
v2:
SELECT (SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT 1,1) as SecondHighestSalary;