FastPrepEmployees Whose Manager Left the Company

Employees Whose Manager Left the Company

ZS logoZS● EasyNEW GRADONSITE INTERVIEW

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

ColumnTypeNullableDescription
employee_idPKIntegerNo—
nameTextNo—
manager_idIntegerYes—
salaryIntegerNo—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
employee_idIntegerNo—

Row order: must match exactly. Numeric tolerance: 0.

Constraints

  • employee_id is unique.
  • manager_id may be null or may reference an employee who is no longer present.
  • Return one row per qualifying employee, ordered by employee_id.

More ZS problems

See ZS hiring insights