码迷,mamicode.com
首页 > 数据库 > 详细

LeetCode_Mysql_Second Highest Salary

时间:2017-07-09 21:52:16      阅读:155      评论:0      收藏:0      [点我收藏+]

标签:执行时间   ret   imu   交流   -o   图片   number   pop   opera   

176. Second Highest Salary

技术分享


1. 问题描写叙述:

写一个sql语句从 Employee 表里获取第二高位的工资。

2. 解决思路:

这道题非常easy,就当热身了。首先用max找到最高工资。
然后去找小于最高工资里的最高工资就是第二高的工资。

3. sql语句:

select Max(Salary) 
from Employee 
where Salary < (select Max(Salary) from Employee)

4. 执行时间:

技术分享


希望多多交流指正!

LeetCode_Mysql_Second Highest Salary

标签:执行时间   ret   imu   交流   -o   图片   number   pop   opera   

原文地址:http://www.cnblogs.com/yangykaifa/p/7143125.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!