Solving Delete Duplicate Emails in SQL. Please try yourself first to solve the problem and submit your implementation to LeetCode before looking into solution.

Problem 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.

+----+------------------+
| Id | Email |
+----+------------------+
| 1 | [email protected] |
| 2 | [email protected] |
| 3 | [email protected] |
+----+------------------+

Id is the primary key column for this table.

For example, after running your query, the above Person table should have the following rows:

+----+------------------+
| Id | Email |
+----+------------------+
| 1 | [email protected] |
| 2 | [email protected] |
+----+------------------+

Note: Your output is the whole Person table after executing your sql. Use delete statement.

See the full details of the problem Delete Duplicate Emails at LeetCode

Originally posted at: @github.com/ignacio-chiazzo/Algorithms-Leetcode-Javascript