sql easy

    176. 第二高的薪水

    1. select (select distinct salary from employee order by salary desc limit 1,1)
    2. SecondHighestSalary;

    笔记

    这里有一点需要注意, 题目中说 如果没有显示 null, 如果直接按照下面的查询, 空数据就会显示空, 不会显示 null, 再 select 一下就会显示 null:

    select distinct salary SecondHighestSalary from employee order by salary desc limit 1,1;