1、查询第二高的薪水
select distinct salary as
from employee
order by salary
limit 1 offset 1;
保证非空:
//IFNULL() function
select IFNULL(select..., null);
或者
select (select...);
2、查询连续三个Num相同的记录
SELECT DISTINCT
l1.Num AS ConsecutiveNums
FROM
Logs l1,
Logs l2,
Logs l3
WHERE
l1.Id = l2.Id - 1
AND l2.Id = l3.Id - 1
AND l1.Num = l2.Num
AND l2.Num = l3.Num
;