# 176. Second Highest Salary

**<font color=red>难度: Easy</font>**

## 刷题内容

> 原题连接

* https://leetcode.com/problems/second-highest-salary/description/

> 内容描述

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

+----+--------+
| Id | Salary |
+----+--------+
| 1  | 100    |
| 2  | 200    |
| 3  | 300    |
+----+--------+
For example, given the above Employee table, the query should return 200 as the second highest salary. If there is no second highest salary, then the query should return null.

+---------------------+
| SecondHighestSalary |
+---------------------+
| 200                 |
+---------------------+
```

## 解题方案

> 思路 1

```sql
select Salary SecondHighestSalary from Employee
union
select null
order by SecondHighestSalary desc limit 1, 1
```


> 思路 2

```sql
select (
  select distinct Salary from Employee order by Salary Desc limit 1, 1
)as SecondHighestSalary
```
