File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed
Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ Return the result table in any order.
2626
2727SELECT t1 .name AS Employee
2828FROM Employee AS t1
29- JOIN
29+ LEFT JOIN
3030 Employee AS t2
3131 ON t1 .managerId = t2 .id
3232WHERE t1 .salary > t2 .salary
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments