File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
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 ;
You can’t perform that action at this time.
0 commit comments