设为首页 加入收藏

TOP

Duplicate Emails解题报告
2015-11-21 01:34:19 来源: 作者: 【 】 浏览:0
Tags:Duplicate Emails 解题 报告

目录

目录 题目 解题思路 AC SQL


题目

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

Id Email
1 a@b.com
2 c@d.com
3 a@b.com

For example, your query should return the following for the above table:

Email
a@b.com

Note: All emails are in lowercase.


解题思路

题目需要从Person表中找出重复出现的Email。

解题方法也很简单:按照Email分组,然后找出id出现次数超过1的Email,即使用group by 和 having 实现。


AC SQL

select Email from Person group by Email having count(id) > 1;
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇EXP(SUM(LOG(字段)))的实践 下一篇使用MySQLWorkbench远程管理工具..

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: