leetcode 学习(2)

A邱凌

关注

阅读 57

2022-02-23

1、查找第N高的薪水

 set n=n-1;
  RETURN (
      # Write your MySQL query statement below.
    select ifnull(
    (select distinct salary from Employee order by salary desc limit n,1),null)as SecondHighestSalary

1、注意题目中的N 的值
2、查找表中是否有N没有输出null

select ifnull

3、第n个
前面一个数是第几个数 ,后面一个数是输出几位数

limit n,1

精彩评论(0)

0 0 举报