Skip to content

Commit 189fca6

Browse files
committed
task: #577
1 parent 9d3f068 commit 189fca6

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Have a good contributing!
3838
- [182. Duplicate Emails](./leetcode/easy/182.%20Duplicate%20Emails.sql)
3939
- [183. Customers Who Never Order](./leetcode/easy/183.%20Customers%20Who%20Never%20Order.sql)
4040
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
41+
- [577. Employee Bonus](./leetcode/easy/577.%20Employee%20Bonus.sql)
4142
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
4243

4344
## License

leetcode/easy/181. Employees Earning More Than Their Managers.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Return the result table in any order.
2626

2727
SELECT t1.name AS Employee
2828
FROM Employee AS t1
29-
JOIN
29+
LEFT JOIN
3030
Employee AS t2
3131
ON t1.managerId = t2.id
3232
WHERE t1.salary > t2.salary
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
Question 577. Employee Bonus
3+
Link: https://leetcode.com/problems/employee-bonus/description/
4+
5+
Table: Employee
6+
7+
+-------------+---------+
8+
| Column Name | Type |
9+
+-------------+---------+
10+
| empId | int |
11+
| name | varchar |
12+
| supervisor | int |
13+
| salary | int |
14+
+-------------+---------+
15+
empId is the column with unique values for this table.
16+
Each row of this table indicates the name and the ID
17+
of an employee in addition to their salary and the id of their manager.
18+
19+
20+
Table: Bonus
21+
22+
+-------------+------+
23+
| Column Name | Type |
24+
+-------------+------+
25+
| empId | int |
26+
| bonus | int |
27+
+-------------+------+
28+
empId is the column of unique values for this table.
29+
empId is a foreign key (reference column) to empId from the Employee table.
30+
Each row of this table contains the id of an employee and their respective bonus.
31+
32+
33+
Write a solution to report the name and
34+
bonus amount of each employee with a bonus less than 1000.
35+
36+
Return the result table in any order.
37+
*/
38+
39+
SELECT
40+
Employee.name,
41+
Bonus.bonus
42+
FROM Employee
43+
LEFT JOIN
44+
Bonus
45+
ON Employee.empId = Bonus.empId
46+
WHERE Bonus.bonus < 1000 OR Bonus.bonus IS NULL

0 commit comments

Comments
 (0)