Skip to content

Commit 8bca11b

Browse files
Create README - LeetHub
1 parent aafd1d6 commit 8bca11b

File tree

1 file changed

+50
-0
lines changed
  • 1978-employees-whose-manager-left-the-company

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<h2><a href="https://leetcode.com/problems/employees-whose-manager-left-the-company/">1978. Employees Whose Manager Left the Company</a></h2><h3>Easy</h3><hr><div class="sql-schema-wrapper__3VBi"><a class="sql-schema-link__3cEg">SQL Schema<svg viewBox="0 0 24 24" width="1em" height="1em" class="icon__1Md2"><path fill-rule="evenodd" d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></svg></a></div><div><p>Table: <code>Employees</code></p>
2+
3+
<pre>+-------------+----------+
4+
| Column Name | Type |
5+
+-------------+----------+
6+
| employee_id | int |
7+
| name | varchar |
8+
| manager_id | int |
9+
| salary | int |
10+
+-------------+----------+
11+
employee_id is the primary key for this table.
12+
This table contains information about the employees, their salary, and the ID of their manager. Some employees do not have a manager (manager_id is null).
13+
</pre>
14+
15+
<p>&nbsp;</p>
16+
17+
<p>Write an SQL query to report the IDs of the employees whose salary is strictly less than <code>$30000</code> and whose manager left the company. When a manager leaves the company, their information is deleted from the <code>Employees</code> table, but the reports still have their <code>manager_id</code> set to the manager that left.</p>
18+
19+
<p>Return the result table ordered by <code>employee_id</code>.</p>
20+
21+
<p>The query result format is in the following example.</p>
22+
23+
<p>&nbsp;</p>
24+
<p><strong class="example">Example 1:</strong></p>
25+
26+
<pre><strong>Input: </strong>
27+
Employees table:
28+
+-------------+-----------+------------+--------+
29+
| employee_id | name | manager_id | salary |
30+
+-------------+-----------+------------+--------+
31+
| 3 | Mila | 9 | 60301 |
32+
| 12 | Antonella | null | 31000 |
33+
| 13 | Emery | null | 67084 |
34+
| 1 | Kalel | 11 | 21241 |
35+
| 9 | Mikaela | null | 50937 |
36+
| 11 | Joziah | 6 | 28485 |
37+
+-------------+-----------+------------+--------+
38+
<strong>Output:</strong>
39+
+-------------+
40+
| employee_id |
41+
+-------------+
42+
| 11 |
43+
+-------------+
44+
45+
<strong>Explanation:</strong>
46+
The employees with a salary less than $30000 are 1 (Kalel) and 11 (Joziah).
47+
Kalel's manager is employee 11, who is still in the company (Joziah).
48+
Joziah's manager is employee 6, who left the company because there is no row for employee 6 as it was deleted.
49+
</pre>
50+
</div>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy