FastPrepEmployees with Matching Departments
Problems/Employees with Matching Departments

Employees with Matching Departments

AMD logoAMD● EasyFULLTIMEONSITE INTERVIEW
QuestionConstraints

Problem statement

Source note: The report identifies the first SQL task as an inner join but gives no tables or query text. The employee/department schema, duplicate and NULL rules, bounds and examples are authored practice. Later undisclosed SQL parts are not reconstructed. Approximate source match: 65%.

Return the employee ID, employee name and department name for every matching pair of rows in employees and departments. A pair matches when their non-NULL department_id values are equal.

employees(employee_id, employee_name, department_id) has a unique, non-NULL integer employee ID, a non-NULL text name and a nullable integer department ID. departments(department_id, department_name) has a nullable integer department ID and nullable text name. Department rows and keys may repeat.

Return columns employee_id, employee_name, department_name in that order. Preserve one result row per matching pair, including identical duplicates and NULL department names. Exclude unmatched rows. A NULL join key never matches, even with another NULL. Result rows may be in any 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—
employee_nameTextNo—
department_idIntegerYes—

departments

ColumnTypeNullableDescription
department_idIntegerYes—
department_nameTextYes—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
employee_idIntegerNo—
employee_nameTextNo—
department_nameTextYes—

Row order: any order is accepted. Numeric tolerance: 0.

Constraints

  • Each input table has between 0 and 10 rows.
  • Non-NULL IDs are integers from -1000000 to 1000000.
  • Each name has at most 10 ASCII letters, digits or spaces.

More AMD problems

  • Insert After a Linked-List NodeONSITE INTERVIEW · Seen Oct 2026
  • LRU CacheONSITE INTERVIEW · Seen Oct 2026
  • Lowest Common Ancestor of a Binary TreePHONE SCREEN · Seen Oct 2026
All AMD interview questionsSee AMD hiring insights