Leetcode: Replace Employee ID with the Unique Identifier
This is another SQL Schema question that is commonly asked at Point72.
We want to be able to short the unique id of each user. We want to see the primary id of a table, etc.
We want to make an SQL query showing the unique ID of each user. The result is name, and for the results that we have no name, we will display NULL instead. This indicates that we must perform a LEFT JOIN. This turns out because we need to select the name and unique id and join the clause ON the id join that is performed. Here's the final solution:
SELECT eu.unique_id,
e.name
FROM Employees as e
LEFT JOIN EmployeeUNI as eu
ON e.id = eu.id;



Comments
Post a Comment