FastPrepDepartments Without Employees

Departments Without Employees

Dell Technologies logoDell Technologies● EasyFULLTIMEPHONE SCREEN

Problem statement

Return every department that currently has no employees assigned to it.

The departments table contains the complete department catalog. The employees.department_id field is nullable for employees who have not yet been assigned. Return each unstaffed department's ID and name in ascending department-ID 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.

departments

ColumnTypeNullableDescription
department_idPKIntegerNo—
department_nameTextNo—

employees

ColumnTypeNullableDescription
employee_idPKIntegerNo—
employee_nameTextNo—
department_idIntegerYes—

Foreign key: department_id → departments(department_id)

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
department_idIntegerNo—
department_nameTextNo—

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

Constraints

  • Department IDs and employee IDs are unique positive integers.
  • Every non-null employee department ID references an existing department.
  • Department names are nonempty.
  • There may be departments or employees with no matching assignment.

More Dell Technologies problems

See Dell Technologies hiring insights