SQL Quest › SQL Interview Questions › Aggregation & Grouping
Find Duplicate Emails
The data team found quality issues! Write a SQL query to find all duplicate email addresses in the customers table. Return the email and how many times it appears. Order by occurrence count descending. This is a classic interview question!
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
customers
| customer_id | name | signup_date | membership | total_orders | |
|---|---|---|---|---|---|
| 1 | John Smith | john.smith@email.com | 2023-01-15 | Gold | 15 |
| 2 | Emma Wilson | emma.wilson@email.com | 2023-03-20 | Silver | 8 |
| 3 | Michael Brown | michael.brown@email.com | 2023-02-10 | Gold | 12 |
Expected output: john.smith@email.com | 2, emma.wilson@email.com | 2, daniel.martinez@email.com | 2
Hint
Concepts
SELECT GROUP BY HAVING Aggregation GROUP BY + HAVING
Practise the topic: SQL practice questions · GROUP BY exercises
In these company practice sets
Plaid · Snowflake · Goldman Sachs
A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.
Related questions
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test