Skip to content

Practice Employees Whose Manager Left the Company

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1978
LeetCode Problem

Employees Whose Manager Left the Company

Problem Statement

Tables: Employees(employee_id INT, name VARCHAR, manager_id INT, salary INT). Employees.employee_id is unique. manager_id may be null when an employee has no manager. Departed managers have no row, but their reports retain their former manager_id. Return employee_id for employees earning strictly less than 30000 whose non-null manager_id does not match any remaining employee. A null manager does not represent a departed manager. Order by employee_id ascending.

Source: Employees Whose Manager Left the Company on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Employees table: +-------------+-----------+------------+--------+ | employee_id | name      | manager_id | salary | +-------------+-----------+------------+--------+ | 3           | Mila      | 9          | 60301  | | 12          | Antonella | null       | 31000  | | 13          | Emery     | null       | 67084  | | 1           | Kalel     | 11         | 21241  | | 9           | Mikaela   | null       | 50937  | | 11          | Joziah    | 6          | 28485  | +-------------+-----------+------------+--------+
Output
+-------------+ | employee_id | +-------------+ | 11          | +-------------+

Related LeetCode Problems

Practice more problems similar to Employees Whose Manager Left the Company.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.