Skip to content

Commit 65c3c20

Browse files
ignacio chiazzo cardarelloignacio chiazzo cardarello
ignacio chiazzo cardarello
authored and
ignacio chiazzo cardarello
committed
Duplicate emails
1 parent 7f0abc7 commit 65c3c20

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
Easy
3+
4+
Write a SQL query to find all duplicate emails in a table named Person.
5+
6+
+----+---------+
7+
| Id | Email |
8+
+----+---------+
9+
| 1 | a@b.com |
10+
| 2 | c@d.com |
11+
| 3 | a@b.com |
12+
+----+---------+
13+
For example, your query should return the following for the above table:
14+
15+
+---------+
16+
| Email |
17+
+---------+
18+
| a@b.com |
19+
+---------+
20+
*/
21+
SELECT Email
22+
FROM Person p
23+
group by Email
24+
having count(Email) > 1

0 commit comments

Comments
 (0)