Skip to content

Commit e4164a7

Browse files
committed
1118
1 parent 2341db9 commit e4164a7

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ Feel free to submit pull requests, add issues and be a contributer.
266266
## SQL
267267
| Website | Title | Solution | Time | Space | Difficulty | Note|
268268
|---------------- |---------------- | ----------- | --------------- | --------------- | ------------- |-----|
269+
| Leetcode | [177. Nth Highest Salary](https://leetcode.com/problems/nth-highest-salary/description/) | [SQL](./sql/nth-highest-salary.sql) | _O(n)_ | _O(1)_ | Medium | |
269270
| Leetcode | [181. Employees Earning More Than Their Managers](https://leetcode.com/problems/employees-earning-more-than-their-managers/description/) | [SQL](./sql/MoreThanManager.sql) | _O(n)_ | _O(1)_ | Easy | |
270271
| Leetcode | [197. Rising Temperature](https://leetcode.com/problems/rising-temperature/description/) | [SQL](./sql/RisingTemperature.sql) | _O(n)_ | _O(1)_ | Easy | |
271272
| Leetcode | [597. Friend Requests I: Overall Acceptance Rate](https://leetcode.com/problems/friend-requests-i-overall-acceptance-rate/description/) | [SQL](./sql/FriendRequests1.sql) | _O(n)_ | _O(1)_ | Easy | |

sql/nth-highest-salary.sql

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
2+
BEGIN
3+
DECLARE M INT;
4+
SET M=N-1;
5+
RETURN (
6+
# Write your MySQL query statement below.
7+
SELECT DISTINCT Salary FROM Employee ORDER BY Salary DESC LIMIT M, 1
8+
);
9+
END

0 commit comments

Comments
 (0)