Sobes.tech
Junior — Senior

Employees with a missing manager in the database

livecode

Task condition

Formulate an SQL query that returns the identifiers of employees earning less than 30,000 units, whose immediate supervisor no longer works at the company. When an employee leaves, their record is deleted from the Employees table, but their subordinates' manager_id remains unchanged.

In the table, employee_id serves as the primary key. The table stores information about employees, their salaries, and their manager's identifier. For some records, the value of manager_id is NULL, indicating the absence of a manager.

The result should be displayed as columns (employee_id, salary), sorted by employee_id.

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| employee_id | int     |
| name        | varchar |
| manager_id  | int     |
| salary      | int     |
+-------------+---------+