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
from Person
where id not in (
select sub.min_id
from (
select email, min(id) as min_id
from Person
group by email
)sub)
delete p1
from Person p1
inner join Person p2 on p1.Email = p2.Email
where p1.Id > p2.Id
'코딩 연습 > SQL' 카테고리의 다른 글
윈도우 함수 (Window Functions) (0) | 2022.08.14 |
---|---|
조인 조건이 특이한 문제 풀이 (0) | 2022.08.13 |
leetcode 627 swap salary (0) | 2022.08.09 |
인프런: SQL 중급 문제 풀이 (2) | 2022.07.16 |
[leetcode] 595 ~ (0) | 2022.04.21 |