SQL interview question: Find Duplicate Emails
Find Duplicate Email Addresses
The security team discovered that some users accidentally created multiple accounts with the same email during a migration.
Find all email addresses that appear more than once. Return email and occurrence_count.
Order by email alphabetically.
Skills: GROUP BY and HAVING with COUNT
Tables
customers 12 rows
- customer_id integer PK
- name text
- email text
- city text
- signup_date text
| customer_id | name | city | signup_date | |
|---|---|---|---|---|
| 101 | Alice Mitchell | [email protected] | San Francisco | 2024-01-15 |
| 102 | Bob Chen | [email protected] | New York | 2024-02-20 |
| 103 | Carol Davis | [email protected] | Los Angeles | 2024-03-10 |