Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 428 Bytes

Delete-Duplicate-Emails.md

File metadata and controls

17 lines (14 loc) · 428 Bytes
/**
  Problem Name : Delete Duplicate Emails
  Problem URL : https://leetcode.com/problems/delete-duplicate-emails/
  Description :
     Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.
  Difficulty : Easy
  Language : MySQL
  Category : Database
*/

DELETE p2 FROM Person p, Person p2
WHERE p.id < p2.id 
AND p.email = p2.email;