SQL Notes: Delete Duplicate Emails
Published in
1 min readSep 26, 2021
196. Delete Duplicate Emails
Problem
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.
Example 1:
Input:
Person table:
+----+------------------+
| Id | Email |
+----+------------------+
| 1 | john@example.com |
| 2 | bob@example.com |
| 3 | john@example.com |…