LeetCode/릿코드-Delete Duplicate Emails-MySQL

cosmos·2021년 9월 23일
0
post-thumbnail
post-custom-banner

문제


풀이

  • write an sql query to delete all the duplicate emails, keeping only one unique email with the smallest id.
  • return the result table in any order.
  • the query result format is in the following example.

코드

-- leetcode, Delete Duplicate Emails, mysql
DELETE T1
FROM Person T1, Person T2
WHERE T1.Email = T2.Email AND T1.Id > T2.Id

결과


출처 && 깃허브

leetcode
github

post-custom-banner

0개의 댓글