Skip to content
We areTOP 1%

Duplicate Emails

EasyLeetCodeSQL: Aggregation & GROUP BY
Solve on LeetCode(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Hint and exampleShow

A value is duplicated when its group holds more than one row, so group by that value and test COUNT(*) > 1 in HAVING.

Example: signups(id, phone)

id | phone
1  | 111
2  | 222
3  | 111
4  | 333
SELECT phone
FROM signups
GROUP BY phone
HAVING COUNT(*) > 1;   -- returns 111

More in SQL: Aggregation & GROUP BY

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account