mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
70 lines
1.7 KiB
HTML
70 lines
1.7 KiB
HTML
|
<p>表:<code>Employee</code> </p>
|
|||
|
|
|||
|
<pre>
|
|||
|
+-------------+---------+
|
|||
|
| Column Name | Type |
|
|||
|
+-------------+---------+
|
|||
|
| empId | int |
|
|||
|
| name | varchar |
|
|||
|
| supervisor | int |
|
|||
|
| salary | int |
|
|||
|
+-------------+---------+
|
|||
|
empId 是该表中具有唯一值的列。
|
|||
|
该表的每一行都表示员工的姓名和 id,以及他们的工资和经理的 id。
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p>表:<code>Bonus</code></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
+-------------+------+
|
|||
|
| Column Name | Type |
|
|||
|
+-------------+------+
|
|||
|
| empId | int |
|
|||
|
| bonus | int |
|
|||
|
+-------------+------+
|
|||
|
empId 是该表具有唯一值的列。
|
|||
|
empId 是 Employee 表中 empId 的外键(reference 列)。
|
|||
|
该表的每一行都包含一个员工的 id 和他们各自的奖金。
|
|||
|
</pre>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p>编写解决方案,报告每个奖金 <strong>少于</strong> <code>1000</code> 的员工的姓名和奖金数额。</p>
|
|||
|
|
|||
|
<p>以 <strong>任意顺序</strong> 返回结果表。</p>
|
|||
|
|
|||
|
<p>结果格式如下所示。</p>
|
|||
|
|
|||
|
<p> </p>
|
|||
|
|
|||
|
<p><strong>示例 1:</strong></p>
|
|||
|
|
|||
|
<pre>
|
|||
|
<b>输入:</b>
|
|||
|
Employee table:
|
|||
|
+-------+--------+------------+--------+
|
|||
|
| empId | name | supervisor | salary |
|
|||
|
+-------+--------+------------+--------+
|
|||
|
| 3 | Brad | null | 4000 |
|
|||
|
| 1 | John | 3 | 1000 |
|
|||
|
| 2 | Dan | 3 | 2000 |
|
|||
|
| 4 | Thomas | 3 | 4000 |
|
|||
|
+-------+--------+------------+--------+
|
|||
|
Bonus table:
|
|||
|
+-------+-------+
|
|||
|
| empId | bonus |
|
|||
|
+-------+-------+
|
|||
|
| 2 | 500 |
|
|||
|
| 4 | 2000 |
|
|||
|
+-------+-------+
|
|||
|
<b>输出:</b>
|
|||
|
+------+-------+
|
|||
|
| name | bonus |
|
|||
|
+------+-------+
|
|||
|
| Brad | null |
|
|||
|
| John | null |
|
|||
|
| Dan | 500 |
|
|||
|
+------+-------+</pre>
|