Employees Whose Manager Left the Company
Problem statement
Find the IDs of employees whose salary is strictly less than 30000 and whose recorded manager no longer appears in the Employees table.
Employees with a null manager_id do not qualify. Return employee IDs in ascending order.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
employees
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_idPK | Integer | No | — |
| name | Text | No | — |
| manager_id | Integer | Yes | — |
| salary | Integer | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| employee_id | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
employee_idis unique.manager_idmay be null or may reference an employee who is no longer present.- Return one row per qualifying employee, ordered by
employee_id.