https://leetcode.com/problems/replace-employee-id-with-the-unique-identifier
join 을 사용하여 해결한다.
Employees 테이블의 id와 EmployeeUNI 테이블의 id가 같은 row 를 기준으로 join 한다.
Employees 테이블의 name 이 무조건 포함되어야 하기에 left join 을 사용했다.
select u.unique_id, e.name
from Employees e
left join EmployeeUNI u
on e.id = u.id
< English (feedback by ChatGPT) >
This problem is solved using join.
(This problem can be solved using a JOIN.)
We join Employees table and EmployeeUNI table when the two table's id are the same.
(We join the Employees table with the EmployeeUNI table based on matching id values.)
Name columns from Employees table mucs be included, so we use left join.
(Since we must always include the name column from the Employees table, we use a LEFT JOIN.)
'Coding Interview' 카테고리의 다른 글
[leetcode] 1795. Rearrange Products Table (0) | 2025.05.15 |
---|---|
[leetcode] 627. Swap Salary (0) | 2025.05.12 |
[leetcode] 1795. Rearrange Products Table (0) | 2025.05.10 |
[leetcode] 1741. Find Total Time Spent by Each Employee (0) | 2025.05.10 |
[leetcode] 2356. Number of Unique Subjects Taught by Each Teacher (1) | 2025.05.10 |