Skip to content

Commit ac715d1

Browse files
solved
1 parent 8f76db7 commit ac715d1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

MySQL/577. Employee Bonus.sql

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
-- Table: Employee
2+
3+
-- +-------------+---------+
4+
-- | Column Name | Type |
5+
-- +-------------+---------+
6+
-- | empId | int |
7+
-- | name | varchar |
8+
-- | supervisor | int |
9+
-- | salary | int |
10+
-- +-------------+---------+
11+
-- empId is the column with unique values for this table.
12+
-- 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.
13+
14+
-- Table: Bonus
15+
16+
-- +-------------+------+
17+
-- | Column Name | Type |
18+
-- +-------------+------+
19+
-- | empId | int |
20+
-- | bonus | int |
21+
-- +-------------+------+
22+
-- empId is the column of unique values for this table.
23+
-- empId is a foreign key (reference column) to empId from the Employee table.
24+
-- Each row of this table contains the id of an employee and their respective bonus.
25+
26+
-- Write a solution to report the name and bonus amount of each employee with a bonus less than 1000.
27+
28+
select Employee.name,
29+
Bonus.bonus
30+
from Employee left join Bonus
31+
on Employee.empId = Bonus.empId
32+
where Bonus.bonus < 1000
33+
or Bonus.bonus is null;

0 commit comments

Comments
 (0)