The Replace Employee ID With The Unique Identifier interview question is a database join problem. You are given two tables: one containing employee IDs and names, and another mapping employee IDs to unique identifiers. The task is to return a result table showing each employee's unique identifier alongside their name, including employees who have no unique identifier (shown as NULL).
This SQL problem is asked at Uber, Microsoft, Infosys, Meta, Amazon, Google, Bloomberg, and Adobe because it tests the fundamental understanding of LEFT JOIN in SQL. LEFT JOIN is one of the most commonly used operations in real-world data engineering and analytics pipelines. It evaluates whether candidates understand the difference between INNER JOIN (only matching rows) and LEFT JOIN (all rows from the left table, NULLs for non-matches).
The pattern is a LEFT JOIN between the Employees table and the EmployeeUNI table on the id column. A LEFT JOIN ensures all employees appear in the result, even those without a unique identifier. The unique ID column will contain NULL for those employees. The SQL structure is:
SELECT eu.unique_id, e.name
FROM Employees e
LEFT JOIN EmployeeUNI eu ON e.id = eu.id
This is O(n) in practice with proper indexing on the join key.
Employees table:
| id | name |
|---|---|
| 1 | Alice |
| 2 | Bob |
| 3 | Carol |
EmployeeUNI table:
| id | unique_id |
|---|---|
| 1 | 101 |
| 3 | 103 |
LEFT JOIN result:
| unique_id | name |
|---|---|
| 101 | Alice |
| NULL | Bob |
| 103 | Carol |
Bob has no unique identifier → NULL. Alice and Carol are matched.
id, not the unique_id.e.id instead of eu.unique_id).For the Replace Employee ID With The Unique Identifier coding problem, the database interview pattern is a straightforward LEFT JOIN. Practice writing LEFT JOIN queries for scenarios with missing data, as NULL-handling is essential in real analytics work. Interviewers at Uber and Adobe often follow up with "how would the result change with INNER JOIN?" or "how do you handle NULL in aggregations?" — be ready with clear, concise answers.
| Title | Difficulty | Topics | LeetCode |
|---|---|---|---|
| Product Sales Analysis I | Easy | Solve | |
| Recyclable and Low Fat Products | Easy | Solve | |
| Employee Bonus | Easy | Solve | |
| Average Time of Process per Machine | Easy | Solve | |
| Combine Two Tables | Easy | Solve |