Easy Aggregation Free

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_idnameemailcitysignup_date
101Alice Mitchell[email protected]San Francisco2024-01-15
102Bob Chen[email protected]New York2024-02-20
103Carol Davis[email protected]Los Angeles2024-03-10

Keep going