Skip to content

Commit dcad29f

Browse files
committed
task #176
1 parent 3eed26b commit dcad29f

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ Have a good contributing!
4040
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
4141
- [577. Employee Bonus](./leetcode/easy/577.%20Employee%20Bonus.sql)
4242
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
43+
2. [Medium](./leetcode/medium/)
44+
- [176. Second Highest Salary](./leetcode/medium/176.%20Second%20Highest%20Salary.sql)
4345

4446
## License
4547

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/*
2+
Table: Employee
3+
4+
+-------------+------+
5+
| Column Name | Type |
6+
+-------------+------+
7+
| id | int |
8+
| salary | int |
9+
+-------------+------+
10+
id is the primary key (column with unique values) for this table.
11+
Each row of this table contains information about the salary of an employee.
12+
13+
14+
Write a solution to find the second highest distinct salary from the Employee table. If there is no second highest salary, return null (return None in Pandas)
15+
*/
16+
17+
SELECT MAX(e1.salary) AS SecondHighestSalary
18+
FROM Employee AS e1
19+
WHERE e1.salary < (SELECT MAX(e2.salary) FROM Employee AS e2)

0 commit comments

Comments
 (0)