LeetCode_Mysql_Second Highest Salary,leetcode

來源:互聯網
上載者:User

LeetCode_Mysql_Second Highest Salary,leetcode
176. Second Highest Salary

1. 問題描述:

寫一個sql語句從 Employee 表裡擷取第二高位的工資。

2. 解決思路:

這道題很簡單,就當熱身了。首先用max找到最高工資;
然後去找小於最高工資裡的最高工資就是第二高的工資。

3. sql語句:
select Max(Salary) from Employee where Salary < (select Max(Salary) from Employee)
4. 已耗用時間:

希望多多交流指正!

著作權聲明:本文為博主原創文章,未經博主允許不得轉載。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.