-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path577. Employee Bonus.sql
More file actions
46 lines (37 loc) · 1.15 KB
/
577. Employee Bonus.sql
File metadata and controls
46 lines (37 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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