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
delete a from Person a, Person b
where a.id > b.id and a.email = b.email;
best
DELETE FROM Person WHERE Id NOT IN
(SELECT * FROM(
SELECT MIN(Id) FROM Person GROUP BY Email) as p);
References
https://iwordpower.com/how-to-delete-duplicate-records-in-mysql/
728x90
반응형
'자료구조 알고리즘 > 코딩테스트' 카테고리의 다른 글
1484. Group Sold Products By The Date (0) | 2022.05.30 |
---|---|
1667. Fix Names in a Table (0) | 2022.05.30 |
627. Swap Salary (0) | 2022.05.30 |
1873. Calculate Special Bonus (0) | 2022.05.30 |
1137. N-th Tribonacci Number (0) | 2022.05.27 |