Employees Whose Manager Left the Company
Updated
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.
More ZS Onsite Interview questions
- Merge k Sorted ListsONSITE INTERVIEW · Seen Sep 2026
- Merge Two Sorted Linked ListsONSITE INTERVIEW · Seen Sep 2026
- Fifth Highest Salary In A DepartmentONSITE INTERVIEW · Seen Sep 2026
- Find Duplicate Email AddressesONSITE INTERVIEW · Seen Sep 2026
- Top Salaries By DepartmentONSITE INTERVIEW · Seen Sep 2026
Similar questions at other companies
- Delete Duplicate Employee RecordsInfosys · ONSITE INTERVIEWInfosys interview questions
- Records Created or Updated in a Time WindowPelatro · ONSITE INTERVIEW
- Top Ten Employee SalariesSolytics Partners · ONSITE INTERVIEW
- Latest New JobSphere · ONSITE INTERVIEW
- Employees Above Average SalaryJP Morgan Chase · ONSITE INTERVIEWJP Morgan Chase interview questions
- Employees Without a ManagerBank of America · ONSITE INTERVIEWBank of America interview questions
- Retrieve Every Student RecordLSEG · ONSITE INTERVIEWLSEG interview questions
- Combine Winner and Loser NamesAmazon · ONSITE INTERVIEW
- Conditionally Insert or Update RecordsKlaviyo · ONSITE INTERVIEWKlaviyo interview questions
- Employees with Matching DepartmentsAMD · ONSITE INTERVIEWAMD interview questions