File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ <p >Table: <code >Person</code ></p >
2
+
3
+ <pre >
4
+ +-------------+---------+
5
+ | Column Name | Type |
6
+ +-------------+---------+
7
+ | id | int |
8
+ | email | varchar |
9
+ +-------------+---------+
10
+ id is the primary key (column with unique values) for this table.
11
+ Each row of this table contains an email. The emails will not contain uppercase letters.
12
+ </pre >
13
+
14
+ <p >  ; </p >
15
+
16
+ <p >Write a solution to report all the duplicate emails. Note that it' ; s guaranteed that the email  ; field is not NULL.</p >
17
+
18
+ <p >Return the result table in <strong >any order</strong >.</p >
19
+
20
+ <p >The  ; result format is in the following example.</p >
21
+
22
+ <p >  ; </p >
23
+ <p ><strong class =" example " >Example 1:</strong ></p >
24
+
25
+ <pre >
26
+ <strong >Input:</strong >
27
+ Person table:
28
+ +----+---------+
29
+ | id | email |
30
+ +----+---------+
31
+ | 1 | a@b.com |
32
+ | 2 | c@d.com |
33
+ | 3 | a@b.com |
34
+ +----+---------+
35
+ <strong >Output:</strong >
36
+ +---------+
37
+ | Email |
38
+ +---------+
39
+ | a@b.com |
40
+ +---------+
41
+ <strong >Explanation:</strong > a@b.com is repeated two times.
42
+ </pre >
Original file line number Diff line number Diff line change
1
+ # Write your MySQL query statement below
2
+ SELECT email as Email FROM Person GROUP BY Email HAVING COUNT (* ) > 1 ;
You can’t perform that action at this time.
0 commit comments