File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <h2 ><a href =" https://leetcode.com/problems/employee-bonus " >577. Employee Bonus</a ></h2 ><h3 >Easy</h3 ><hr ><p >Table: <code >Employee</code ></p >
2+
3+ <pre >
4+ +-------------+---------+
5+ | Column Name | Type |
6+ +-------------+---------+
7+ | empId | int |
8+ | name | varchar |
9+ | supervisor | int |
10+ | salary | int |
11+ +-------------+---------+
12+ empId is the column with unique values for this table.
13+ 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.
14+ </pre >
15+
16+ <p >  ; </p >
17+
18+ <p >Table: <code >Bonus</code ></p >
19+
20+ <pre >
21+ +-------------+------+
22+ | Column Name | Type |
23+ +-------------+------+
24+ | empId | int |
25+ | bonus | int |
26+ +-------------+------+
27+ empId is the column of unique values for this table.
28+ empId is a foreign key (reference column) to empId from the Employee table.
29+ Each row of this table contains the id of an employee and their respective bonus.
30+ </pre >
31+
32+ <p >  ; </p >
33+
34+ <p >Write a solution to report the name and bonus amount of each employee who satisfies either of the following:</p >
35+
36+ <ul >
37+ <li>The employee has a bonus <strong>less than</strong> <code>1000</code>.</li>
38+ <li>The employee did not get any bonus.</li>
39+ </ul >
40+
41+ <p >Return the result table in <strong >any order</strong >.</p >
42+
43+ <p >The  ; result format is in the following example.</p >
44+
45+ <p >  ; </p >
46+ <p ><strong class =" example " >Example 1:</strong ></p >
47+
48+ <pre >
49+ <strong >Input:</strong >
50+ Employee table:
51+ +-------+--------+------------+--------+
52+ | empId | name | supervisor | salary |
53+ +-------+--------+------------+--------+
54+ | 3 | Brad | null | 4000 |
55+ | 1 | John | 3 | 1000 |
56+ | 2 | Dan | 3 | 2000 |
57+ | 4 | Thomas | 3 | 4000 |
58+ +-------+--------+------------+--------+
59+ Bonus table:
60+ +-------+-------+
61+ | empId | bonus |
62+ +-------+-------+
63+ | 2 | 500 |
64+ | 4 | 2000 |
65+ +-------+-------+
66+ <strong >Output:</strong >
67+ +------+-------+
68+ | name | bonus |
69+ +------+-------+
70+ | Brad | null |
71+ | John | null |
72+ | Dan | 500 |
73+ +------+-------+
74+ </pre >
You can’t perform that action at this time.
0 commit comments