## 182.编写一个 SQL 查询,查找 Person 表中所有重复的电子邮箱。
person表中数据:
+------+---------+
| Id | Email |
+------+---------+
| 1 | a@b.com |
| 2 | c@d.com |
| 3 | a@b.com |
+------+---------+
只查询重复的值:
select Email from person group by Email having count(Email)>1;
查询结果:
+---------+
| Email |
+---------+
| a@b.com |
+---------+
查询重复的值及重复数量:
select Email,count(*) as count from person group by Email having count>1;
查询结果为:
+---------+-------+
| Email | count |
+---------+-------+
| a@b.com | 2 |
+---------+-------+