Duplicate Emails

Duplicate Emails

Write a SQL query to find all duplicate emails in a table named Person.

Example

±—±--------+
| Id | Email |
±—±--------+
| 1 | [email protected] |
| 2 | [email protected] |
| 3 | [email protected] |
±—±--------+
return
±--------+
| Email |
±--------+
| [email protected] |
±--------+

**Solution

@才发现leetcode有SQL语句题…
# Write your MySQL query staSELECT Email
SELECT Email  
  FROM Person
 GROUP BY Email
HAVING COUNT(*) > 1;

猜你喜欢

转载自blog.csdn.net/byr_wy/article/details/88897979