【LeetCode】182. 查找重复的电子邮箱

1.题目描述:

SQL架构
编写一个 SQL 查询,查找 Person 表中所有重复的电子邮箱。

示例:

+----+---------+
| Id | Email   |
+----+---------+
| 1  | [email protected] |
| 2  | [email protected] |
| 3  | [email protected] |
+----+---------+
根据以上输入,你的查询应返回以下结果:

+---------+
| Email   |
+---------+
| [email protected] |
+---------+
说明:所有电子邮箱都是小写字母。

 

 

2. 提交代码:

# Write your MySQL query statement below
select p.Email as Email from Person p group by p.Email having count(p.Email) > 1;

 

3.性能:

【LeetCode】182. 查找重复的电子邮箱

发现计算时间有一定的随机性,并不是 很精确的,考虑可能是 服务器的速度问题,

4. 优化和扩展