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 ...
随机推荐
- 核PCA与PCA的精髓和核函数的映射实质
1.PCA简介 遭遇维度危机的时候,进行特征选择有两种方法,即特征选择和特征抽取.特征选择即经过某种法则直接扔掉某些特征,特征抽取即利用映射的方法,将高维度的样本映射至低维度.PCA(或者K-L变换) ...
- 面试题: mysql 数据库去重 已看1 不好使
mysql去重面试总结 前言:题目大概是这样的. 建表: ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 CREATE TABLE `test2` ( `id` ...
- Luogu 2900 [USACO08MAR]土地征用Land Acquisition
斜率优化dp. 首先发现如果存在$x$和$y$使得$len(x) \geq len(y)$并且$wid(x) \geq wid(y)$,那么$y$直接不考虑就好了,因为在买$x$的时候就把$y$顺便带 ...
- charles解决相应乱码问题
Charles.ini 文件手动添加vmarg.5=-Dfile.encoding=UTF-8
- servlet与filter的加载顺序详解
项目:3个filter,3个servlet,匹配的url路径/hello. 情况1:servlet没加<load-on-startup></load-on-startup>情 ...
- vue入门(一)----组件
由于工作需要,最近在写一些前端的东西.经过向开发经验丰富的前端工程师的请教之后,得出一个结论----2016年前端被玩坏了,其实对于我来说我并不是太了解这句话的深刻含义,只是觉得是不是因为前端技术突飞 ...
- Codeforces - 102222A - Maximum Element In A Stack - 模拟
https://codeforc.es/gym/102222/problem/F 注意到其实用unsigned long long不会溢出. #include<bits/stdc++.h> ...
- mysql 索引总结
一.MYSQL索引类型(共三种) 1).normal 正常 应用场景:普通的index 2).unique 唯一性的 应用场景:比如身份证的 3).full text 全文索引 应用场景:较长文字 二 ...
- hdu1521(字典树模板)
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1251 题意: 中文题诶~ 思路: 字典树模板 代码1: 动态内存, 比较好理解一点, 不过速度略慢, ...
- luogup3834(主席树模板)
luogup3834(主席树模板) 给定由N个正整数构成的序列,将对于指定的闭区间查询m次其区间内第k小值.1≤N,M≤2e5. 有一个做法,是对于每个序列的前缀建一颗权值线段树,然后通过权值线段树相 ...