mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-10 18:48:13 +08:00
49 lines
1.3 KiB
HTML
49 lines
1.3 KiB
HTML
<p>表: <code>Employee</code></p>
|
||
|
||
<pre>
|
||
+-------------+---------+
|
||
| Column Name | Type |
|
||
+-------------+---------+
|
||
| id | int |
|
||
| name | varchar |
|
||
| department | varchar |
|
||
| managerId | int |
|
||
+-------------+---------+
|
||
id 是此表的主键(具有唯一值的列)。
|
||
该表的每一行表示雇员的名字、他们的部门和他们的经理的id。
|
||
如果managerId为空,则该员工没有经理。
|
||
没有员工会成为自己的管理者。
|
||
</pre>
|
||
|
||
<p> </p>
|
||
|
||
<p>编写一个解决方案,找出至少有<strong>五个直接下属</strong>的经理。</p>
|
||
|
||
<p>以 <strong>任意顺序 </strong>返回结果表。</p>
|
||
|
||
<p>查询结果格式如下所示。</p>
|
||
|
||
<p> </p>
|
||
|
||
<p><strong>示例 1:</strong></p>
|
||
|
||
<pre>
|
||
<strong>输入:</strong>
|
||
Employee 表:
|
||
+-----+-------+------------+-----------+
|
||
| id | name | department | managerId |
|
||
+-----+-------+------------+-----------+
|
||
| 101 | John | A | Null |
|
||
| 102 | Dan | A | 101 |
|
||
| 103 | James | A | 101 |
|
||
| 104 | Amy | A | 101 |
|
||
| 105 | Anne | A | 101 |
|
||
| 106 | Ron | B | 101 |
|
||
+-----+-------+------------+-----------+
|
||
<strong>输出:</strong>
|
||
+------+
|
||
| name |
|
||
+------+
|
||
| John |
|
||
+------+</pre>
|