LeetCode 176. 第二高的薪水 Posted on 2022-04-08 Edited on 2023-07-04 In 指尖飞舞 , 数据库 , MySQL 摘要:数据库TopK问题 题目LeetCode 176. 第二高的薪水 子查询MySQL1234567select(select distinctsalary from Employeeorder by salary desclimit 1 offset 1) as SecondHighestSalary; 对于子查询: 1234select distinctsalary from Employeeorder by salary desclimit 1 offset 1 将查询产生一个临时数据集,当数据库总行数 <= 1时,由于偏移的作用,将产生一个空集。使用第二次查询可以查到null值,满足题目要求。 原题链接: LeetCode 176. 第二高的薪水 Post author: zxy Post link: https://ntifs.com/2022/04/08/LeetCode-176-第二高的薪水/ Copyright Notice: All articles in this blog are licensed under BY-NC-SA unless stating additionally.