
解题思路
看看有什么难点呢?
limit没搞过?note:0为first line
limit 5,10 ----5为begin line,10为offset ---其实就是取几行啦
limit 5----0-4 lines ----默认0开始数五行
limit 1 offset 1,相信你也会啦!
ifnull是什么呀?
翻翻官方文档
ifnull(expr1,expr2)
if expr1 is not null,return expr1
else return expr2

nullif是啥呢?
nullif(expr1,expr2)
if expr1=expr2 return null
else return expr1

if(expr1,expr2,expr3)
这玩意和三目运算符一样

代码
# Write your MySQL query statement below
select
ifnull((select Employee.Salary
from Employee
Group by Salary desc
limit 1 offset 1),null) as SecondHighestSalary ;
网友评论