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.

Code

SELECT Email from Person GROUP BY Email HAVING count(Email) > 1

[LeetCode] 182. Duplicate Emails_Easy tag: SQL的更多相关文章

  1. [LeetCode] 196. Delete Duplicate Emails_Easy tag: SQL

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

  2. leetcode 182. Duplicate Emails having的用法 SQL执行顺序

    https://leetcode.com/problems/duplicate-emails/description/ 首先sql的执行顺序是 from-->where-->group b ...

  3. Leetcode 182. Duplicate Emails

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

  4. [LeetCode] 197. Rising Temperature_Easy tag: SQL

    Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to ...

  5. [LeetCode] 595. Big Countries_Easy tag: SQL

    There is a table World +-----------------+------------+------------+--------------+---------------+ ...

  6. LeetCode 182. Duplicate Emails (查找重复的电子邮箱)

    题目标签: 题目给了我们一个 email 的table,让我们找到重复的 email. 可以建立 Person a, Person b, 找到两个表格中,emai 相等 但是 id 不同的 email ...

  7. [LeetCode] 610. Triangle Judgement_Easy tag: SQL

    A pupil Tim gets homework to identify whether three line segments could possibly form a triangle. Ho ...

  8. [LeetCode] 607. Sales Person_Easy tag: SQL

    Description Given three tables: salesperson, company, orders.Output all the names in the table sales ...

  9. [LeetCode] 577. Employee Bonus_Easy tag: SQL

    Select all employee's name and bonus whose bonus is < 1000. Table:Employee +-------+--------+---- ...

随机推荐

  1. git怎么使用

    1_创建一个git服务器 2_开发人员小A从服务器拉取代码 3_小A提交代码 4_小c拉取代码 5_小a现在的代码 6_小c改变了小a的代码 7_小c将变更提交一下 8_小a拉取服务器的代码 9_小A ...

  2. 【Spring源码深度解析学习系列】注册解析的BeanDefinition(五)

    对于配置文件,解析和装饰完成之后,对于得到的beanDefinition已经可以满足后续的使用要求了,还剩下注册,也就是processBeanDefinition函数中的BeanDefinitionR ...

  3. HR别掉坑里了,送你最精确的计薪算法!

      月工资的计算方式有多种多样.即便是资深的HR,也会犯常识性的错误,正算反算,哪一个方法更适合,有时还会容易出现数字偏差,回想一下,你们公司的工资是如何计算的? 第一 劳动工资计算标准按几天计算 根 ...

  4. 第一步 使用sencha touch cmd 4.0 创建项目、打包(加入全局变量、公用类、自定义扩展、资源文件)

    参考资料: http://www.cnblogs.com/qqloving/archive/2013/04/25/3043606.html http://www.admin10000.com/docu ...

  5. 如何在Computer下添加System Folder(续)

    之前的一篇博客如何在Computer下添加System Folder里提到需要每次都使用一个新的guid,否则再次在"HKEY_LOCAL_MACHINE\SOFTWARE\Microsof ...

  6. [VS]VS2010如何使用Visual Studio Online在线服务管理团队资源(在线TFS)

    前言 Visual Studio Online,也就是以前的Team Foundation Service,从名字可以看出这是一个团队资源管理服务.在微软的云基础架构中运行,无需安装或配置任何服务器, ...

  7. CentOS安装php及其扩展

    列出所有的可安装的软件包 yum list | grep php56w* | grep redis 安装php及其扩展 yum install  -y php56w php56w-mysql php5 ...

  8. split陷阱

    如果split最后一个为空,则要这么写 String[] lines=line.split(",",-1);

  9. @staticmethod和@classmethod的作用与区别

    一般来说,要使用某个类的方法,需要先实例化一个对象再调用方法. 而使用@staticmethod或@classmethod,就可以不需要实例化,直接类名.方法名()来调用. 这有利于组织代码,把某些应 ...

  10. octomap的简介

    装载自高翔博士的博客:https://www.cnblogs.com/gaoxiang12/p/5041142.html 什么是octomap? RGBD SLAM的目的有两个:估计机器人的轨迹,并建 ...