leetcode 176 第二高的薪水,查第二高的人的信息
1、使用ifnull(exp1, exp2)函数,limit offset子句
select ifnull(
(select distinct salary
from Employee
order by salary
desc limit 1 offset 1),
null)
as SecondHighestSalary
limit 1 offset 1 等同于 limit 1,1 第一个1代表从第几条开始取,最开始的index是第0条。 2、使用 子查询 以及 limit offset子句
select (
select distinct salary
from Employee
order by salary desc
limit 1 offset 1
) as SecondHighestSalary
标签:salary,limit,offset,176,leetcode,select From: https://www.cnblogs.com/carlzhang19/p/17269529.html