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的更多相关文章

  1. [LeetCode] Delete Duplicate Emails 删除重复邮箱

    Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...

  2. [LeetCode] Duplicate Emails 重复的邮箱

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

  3. LeeCode(Database)-Duplicate Emails

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

  4. Leetcode 182. Duplicate Emails

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

  5. [SQL]LeetCode182. 查找重复的电子邮箱 | Duplicate Emails

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

  6. LeetCode DB: Duplicate Emails

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

  7. 【SQL】182. Duplicate Emails

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

  8. LeetCode - Duplicate Emails

    Description:Write a SQL query to find all duplicate emails in a table named Person. 找出表中重复的Email. # ...

  9. 182. Duplicate Emails

    Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...

随机推荐

  1. 谁是Docker的开发者

    由CHRIS DAWSON发表在thenewstack/DATA RESEARCH qianhen123/CHB译 我们分析了Docker的容器库并提出两个问题: 1.Docker的贡献者们感兴趣的其 ...

  2. IoC概述

    ---------------siwuxie095 IoC,即 Inversion of Control,控制反转,它是 Spring 容器的内核 AOP.声明式事务等功能都是在此基础上开花结果,即 ...

  3. webAPI中使用FormsAuthenticationTicket作为登录权限票据

    最近在做的项目得到经验,在做登录的时候,使用FormsAuthenticationTicket, 登录成功以后生成cookia作为登录态维护,票据作为调用其他接口的凭据,票据生成后传到前台作为调用接口 ...

  4. java多线程有几种实现方法,都是什么?

    转自:http://www.cnblogs.com/liujichang/p/3150387.html 多线程有两种实现方法,分别是继承Thread类与实现Runnable接口 同步的实现方法有两种, ...

  5. js中的cookie的设置获取和检查

    设置cookiefunction setCookie(cname,cvalue,exdays) { var d = new Date(); d.setTime(d.getTime()+(exdays* ...

  6. Unity3D 脚本模板修改方法

    默认情况下,在Unity中创建C#脚本都会默认生成以下代码模板. using System.Collections; using System.Collections.Generic; using U ...

  7. 关于UsedRange方法选中了空区域的解决方案

    使用worksheet.usedrange属性去制作数据透视表的时候会出现blank项,debug时发现它选中了空的区域. 解决方案: 属性usedrange包含着带格式的.空白的单元格(即使设置过单 ...

  8. 程序员笔记|详解Eureka 缓存机制

    引言 Eureka是Netflix开源的.用于实现服务注册和发现的服务.Spring Cloud Eureka基于Eureka进行二次封装,增加了更人性化的UI,使用更为方便.但是由于Eureka本身 ...

  9. win10外接显示器时有些应用和里面的字体显示比较模糊

    打开系统设置 - 选择显示 - 选中外接的显示器 - 点击 "高级缩放设置" 进去后将 "允许 Windows  尝试修改应用,使其不模糊"打开,然后关闭应用再 ...

  10. bzoj 3123: [Sdoi2013]森林(45分暴力)

    3123: [Sdoi2013]森林 Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 4184  Solved: 1235[Submit][Status ...