Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Have a good contributing!
- [182. Duplicate Emails](./leetcode/easy/182.%20Duplicate%20Emails.sql)
- [183. Customers Who Never Order](./leetcode/easy/183.%20Customers%20Who%20Never%20Order.sql)
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
- [577. Employee Bonus](./leetcode/easy/577.%20Employee%20Bonus.sql)
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)

## License
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Return the result table in any order.

SELECT t1.name AS Employee
FROM Employee AS t1
JOIN
LEFT JOIN
Employee AS t2
ON t1.managerId = t2.id
WHERE t1.salary > t2.salary
46 changes: 46 additions & 0 deletions leetcode/easy/577. Employee Bonus.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
Question 577. Employee Bonus
Link: https://leetcode.com/problems/employee-bonus/description/

Table: Employee

+-------------+---------+
| Column Name | Type |
+-------------+---------+
| empId | int |
| name | varchar |
| supervisor | int |
| salary | int |
+-------------+---------+
empId is the column with unique values for this table.
Each row of this table indicates the name and the ID
of an employee in addition to their salary and the id of their manager.


Table: Bonus

+-------------+------+
| Column Name | Type |
+-------------+------+
| empId | int |
| bonus | int |
+-------------+------+
empId is the column of unique values for this table.
empId is a foreign key (reference column) to empId from the Employee table.
Each row of this table contains the id of an employee and their respective bonus.


Write a solution to report the name and
bonus amount of each employee with a bonus less than 1000.

Return the result table in any order.
*/

SELECT
Employee.name,
Bonus.bonus
FROM Employee
LEFT JOIN
Bonus
ON Employee.empId = Bonus.empId
WHERE Bonus.bonus < 1000 OR Bonus.bonus IS NULL