Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit bdd6a84

Browse files
committed
Feat: #176
Close:#176
1 parent a583946 commit bdd6a84

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎problems/database/176.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## 题目
2+
[176. 第二高的薪水](https://leetcode-cn.com/problems/second-highest-salary/)
3+
4+
## 思路
5+
需要找出表中第二高的薪水,可以考虑先找出最高的薪水,再从表中找出小于最高薪水剩余部分中最高的薪水,即为第二高薪水。
6+
7+
## 代码
8+
```
9+
# Write your MySQL query statement below
10+
select max(e1.Salary) as SecondHighestSalary
11+
from Employee e1
12+
where e1.Salary < (
13+
select max(e2.Salary) from Employee e2
14+
);
15+
```
16+
17+
## 相关知识
18+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /