LeetCode_Mysql_Second Highest Salary

原创 2015年07月08日 16:11:59

176. Second Highest Salary

timu


1. 问题描述:

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

2. 解决思路:

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

3. sql语句:

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

4. 运行时间:

这里写图片描述


希望多多交流指正!

版权声明:本文为博主原创文章,未经博主允许不得转载。

相关文章推荐

LeetCode数据库练习题MySql

LeetCode数据库练习题MySql 175. Combine Two Tables Total Accepted: 15789 Total Submissions: 46540 Difficu...

LeetCode之MySQL题解

LeetCode上MySQL题解

LeetCode Second Highest Salary

Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S...

Leetcode 176. Second Highest Salary

176. Second Highest Salary Total Accepted: 22494 Total Submissions: 100791 Difficulty: Easy Writ...

MySQL-Second Highest Salary

Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S...

Second Highest Salary

Write a SQL query to get the second highest salary from the Employee table. +-

LeetCode | Second Highest Salary & Nth highest salary

Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S...

Leetcode 177. Nth Highest Salary

177. Nth Highest Salary Total Accepted: 10762 Total Submissions: 66455 Difficulty: Medium Write ...

Nth Highest Salary 解法讨论(Mysql)

题目分析 Write a SQL query to get the nth highest salary mysql join order by limit offset

题目8:MySQL---------Department Highest Salary

The Employee table holds all employees. Every employee has an Id, a salary, and there is also a col...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:LeetCode_Mysql_Second Highest Salary
举报原因:
原因补充:

(最多只允许输入30个字)