欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

LeetCode--182.寻找重复的电子邮箱

程序员文章站 2022-07-08 14:24:05
...

LeetCode--182.寻找重复的电子邮箱

建表

Create table If Not Exists Person (Id int,Email varchar(255));
Truncate table Person;
insert into Person (Id, Email) values ('1','aaa@qq.com');
insert into Person (Id, Email) values ('2','aaa@qq.com');
insert into Person (Id, Email) values ('3','aaa@qq.com');

根据邮箱分组统计,个数大于1

select Email, count(1)
 from person
 GROUP BY Email
 HAVING count(1) > 1
相关标签: Leetcode