forked from hijiangtao/LeetCode-with-JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathres.txt
More file actions
22 lines (19 loc) · 572 Bytes
/
res.txt
File metadata and controls
22 lines (19 loc) · 572 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- Write a SQL query to find all duplicate emails in a table named Person.
-- +----+---------+
-- | Id | Email |
-- +----+---------+
-- | 1 | [email protected] |
-- | 2 | [email protected] |
-- | 3 | [email protected] |
-- +----+---------+
-- For example, your query should return the following for the above table:
-- +---------+
-- | Email |
-- +---------+
-- | [email protected] |
-- +---------+
-- Note: All emails are in lowercase.
# Write your MySQL query statement below
SELECT t.eml AS 'Email' FROM
(SELECT count(Email) AS 'cnt', Email AS 'eml' FROM Person GROUP BY Email) as t
WHERE t.cnt>1;