LeetCode 176. Second Highest Salary (第二高的薪水)

题目标签:

  题目给了我们一个工资表,让我们返回第二高的工资。

   利用Max,把第一高的工资找到,然后利用 NOT IN,去找到第二高的工资。

 

Java Solution:

Runtime:  153ms, faster than 44 % 

完成日期:05/22/2019

关键点:MAX, NOT IN

# Write your MySQL query statement below
SELECT Max(Salary) As SecondHighestSalary
FROM Employee
WHERE Salary
NOT IN (SELECT Max(Salary) FROM Employee);

参考资料:LeetCode Solution

LeetCode 题目列表 - LeetCode Questions List

题目来源:https://leetcode.com/

你可能感兴趣的:(LeetCode 176. Second Highest Salary (第二高的薪水))