Find Duplicate Emails
SQL coding challenge · Difficulty: easy · +50 XP
Table: users
+-------+---------+
| Column | Type |
+-------+---------+
| id | INT | | name | VARCHAR | | email | VARCHAR |
+-------+---------+
Primary key: id
email is NOT guaranteed to be unique.
Problem
-------
Find all email addresses that appear more
than once in the users table.
Return: email, count
Order: email ASC
Example Input
-------------
+----+-------+-------------------+
| id | name | email |
+----+-------+-------------------+
| 1 | Alice | alice@example.com | | 2 | Bob | bob@example.com | | 3 | Carol | alice@example.com | | 4 | Dave | dave@example.com | | 5 | Eve | bob@example.com |
+----+-------+-------------------+
Expected Output
---------------
+-------------------+-------+
| email | count |
+-------------------+-------+
| alice@example.com | 2 | | bob@example.com | 2 |
+-------------------+-------+
Hints
-----
- GROUP BY email groups rows with same email
- HAVING COUNT(*) > 1 filters to duplicates only