Skip to content

Commit 6d852ee

Browse files
committed
Upload 130
1 parent 366298a commit 6d852ee

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ The problems and both submitted and site solutions are documented in individual
162162
| 127 | [Consecutive Numbers](https://leetcode.com/problems/consecutive-numbers/description/) | [Solution](solutions/127_consecutive_numbers.md) | LeetCode | Medium | |
163163
| 128 | [Last Person to Fit in the Bus](https://leetcode.com/problems/last-person-to-fit-in-the-bus/description/) | [Solution](solutions/128_last_person_to_fit_in_the_bus.md) | LeetCode | Medium | `ORDER BY turn RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW` |
164164
| 129 | [Count Salary Categories](https://leetcode.com/problems/count-salary-categories/description/) | [Solution](solutions/129_count_salary_categories.md) | LeetCode | Medium | `IFNULL` |
165+
| 130 | [Employees Whose Manager Left the Company](https://leetcode.com/problems/employees-whose-manager-left-the-company/description/) | [Solution](solutions/130_employees_whose_manager_left_the_company.md) | LeetCode | Easy | |
165166
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
166167

167168
## Author(s)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# SQL Everyday \#130
2+
3+
## Employees Whose Manager Left the Company
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Find the IDs of the employees whose salary is strictly less than `$30000` and whose manager left the company. When a manager leaves the company, their information is deleted from the `Employees` table, but the reports still have their `manager_id` set to the manager that left.
11+
12+
Return the result table ordered by `employee_id`. [[Full Description](https://leetcode.com/problems/employees-whose-manager-left-the-company/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
SELECT
19+
e1.employee_id AS employee_id
20+
FROM Employees e1
21+
LEFT JOIN Employees e2 ON e1.manager_id = e2.employee_id
22+
WHERE e1.salary < 30000
23+
AND e1.manager_id IS NOT NULL
24+
AND e2.employee_id IS NULL
25+
ORDER BY e1.employee_id ASC
26+
;
27+
```
28+
29+
## Site Solution
30+
31+
```sql
32+
-- LeetCode Solution
33+
-- None
34+
```
35+
36+
## Notes
37+
38+
TBD
39+
40+
## NB
41+
42+
TBD
43+
44+
Go to [Index](../?tab=readme-ov-file#index)\
45+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)