본문 바로가기
  • 👩🏻‍💻 🌮 💬
💻 leetcode/database

[LeetCode] Database | 196. Delete Duplicate Emails

by 바쿄리 2022. 1. 3.

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