Duplicate Emails
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.
用exists
select distinct Email from Person p1 where exists (select Id from Person p2 where p1.Email = p2.Email and p1.Id != p2.Id);
用group by
select Email from Person group by Email having count(Email) > 1;
Duplicate Emails的更多相关文章
- [LeetCode] Delete Duplicate Emails 删除重复邮箱
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- [LeetCode] Duplicate Emails 重复的邮箱
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- LeeCode(Database)-Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- Leetcode 182. Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- [SQL]LeetCode182. 查找重复的电子邮箱 | Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- LeetCode DB: Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- 【SQL】182. Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- LeetCode - Duplicate Emails
Description:Write a SQL query to find all duplicate emails in a table named Person. 找出表中重复的Email. # ...
- 182. Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
随机推荐
- centos6.5安装tomcat7.0教程(二)
阅读之前对基本命不熟悉的话, 可以先安装另一文章: http://www.cnblogs.com/duenboa/articles/6665159.html把基本的命令记一下.后面的文章就不重复演示了 ...
- C语言连接mysql -insert-update
C语言连接mysql数据库实现insert语句:数据库:test表:systeminfo CREATE TABLE `systeminfo` ( `id` int(11) NOT NULL AUTO ...
- C#使用Json.NET解析Json
本文转载自 http://xiaosheng.me/2016/10/01/article25/ 最近在 C# 项目中需要使用到 Json 格式的数据,我简单上网搜索了一下,基本上有两种操作 Json ...
- 手写一个admin 组件------STARK
开一个新的项目,,建立一个stark 包, 在里面创建一个service包,在service 包里创建一个stark.py 文件, 配置好环境, makemigreations, migreate. ...
- Web应用之ActionForm
看链接: 主要就是讲了一下form表单的传递,bean的工作原理. http://blog.csdn.net/java_pengjin/article/details/5987330
- HTML5秘籍(第2版) 中文pdf扫描版
HTML5秘籍(第2版)共包括四个部分,共13章.第一部分介绍了HTML5的发展历程,用语义元素构造网页,编写更有意义的标记,以及构建更好的Web表单.第二部分介绍了HTML5中的音频与视频.CS ...
- C++基础之继承类和派生类
(1)继承是创建一个具有某个类的属性和行为的新类的能力.原有的类称为基类,新创建的类称为派生类.派生类将基类中的所有成员作为自己的成员,同时派生类本身可以定义新的成员(2)派生类只有一个基类的继承称单 ...
- Codeforces Round #527 (Div. 3)D2(栈,思维)
#include<bits/stdc++.h>using namespace std;int a[200007];stack<int>s;int main(){ int ...
- hdu2874(lca / tarjan离线 + RMQ在线)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=2874 题意: 给出 n 个顶点 m 条边的一个森林, 有 k 个形如 x y 的询问, 输出 x, ...
- 用vue写一个仿简书的轮播图
原文地址:用vue写一个仿简书的轮播图 先展示最终效果: Vue的理念是以数据驱动视图,所以拒绝通过改变元素的margin-top来实现滚动效果.写好css样式,只需改变每张图片的class即可实现轮 ...