Problem
Example
Thinking
처음엔 dictinct로 중복 제거를 하려했지만 실패
email 같은 애들끼리 inner join 해주고 id가 큰것들을 그냥 삭제해버렸다.
그랬더니 성공
Solve
제출 답안
DELETE p1 FROM Person p1
INNER JOIN Person p2
ON p1.email = p2.email AND p1.id > p2.id;
https://leetcode.com/problems/delete-duplicate-emails/
Delete Duplicate Emails - LeetCode
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
leetcode.com
'💻 leetcode > database' 카테고리의 다른 글
[LeetCode] Database | 197. Rising Temperature (0) | 2022.01.12 |
---|---|
[LeetCode] Database | 627. Swap Salary (0) | 2022.01.05 |
[LeetCode] Database | 183. Customers Who Never Order (0) | 2022.01.02 |
[LeetCode] Database | 182. Duplicate Emails (0) | 2022.01.02 |
[LeetCode] Database | 181. Employees Earning More Than Their Manager (1) | 2022.01.02 |