Discription:Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.

删除重复的Email地址,保留Id最小的那个。

使用自身连接循环即可。

# Write your MySQL query statement below
delete p1 from Person p1, Person p2
where p1.Email=p2.Email and p1.Id>p2.Id;

LeetCode - Delete 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——Delete Duplicate Emails(巧用mysql临时表)

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

  3. Leetcode 182. Duplicate Emails

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

  4. LeetCode Database: Delete Duplicate Emails

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

  5. leetcode【sql】 Delete Duplicate Emails

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

  6. LeetCode DB : Delete Duplicate Emails

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

  7. leetcode 196. Delete Duplicate Emails 配合查询的delete

    https://leetcode.com/problems/delete-duplicate-emails/description/ 题意要对原来的数据表进行删除,不删除不行,它每次只输出原来那个表. ...

  8. LeetCode 196. Delete Duplicate Emails (删除重复的电子邮箱)

    题目标签: 题目给了我们一个 email 的表格,让我们删除重复的. 建立Person p1,Person p2,当email 相同时,而且 p1 id 要大于 p2 id 时候,删除这一行. Jav ...

  9. leetcode 196. Delete Duplicate Emails

    # 慢,内连接delete p1 from Person p1, Person p2 where p1.Email=p2.Email and p1.Id>p2.Id delete from Pe ...

随机推荐

  1. udev规则以及编写

    主要内容: udev简介 如何配置和使用udev 如何编写udev规则 字符串替换和匹配 udev主要作用 编写udev规则实例 难点解析 1. udev简介 1.1 什么是udev? udev是Li ...

  2. ASP.NET中上传图片检测其是否为真实的图片 防范病毒上传至服务器

    一.需求 我们在用.net开发网站时,经常会用到图片上传,可以说是每个网站必备的,大到门户网站,电商网站,政务系统,OA系统,小到企业网站,个人网站,博客网站,导航网站等等,都有用到图片上传,那么在客 ...

  3. Linux远程复制文件

    将本机文件app.properties 复制到用户为root,ip为ip的具体路径下去 scp app.properties root@ip:/apps/javaconf/common/ 其他参考: ...

  4. Java打印整数的二进制表示(代码与解析)

    Java打印整数的二进制表示(代码与解析) int a=-99; for(int i=0;i<32;i++){ int t=(a & 0x80000000>>>i)&g ...

  5. 单精度浮点数(float)加法计算出错

    场景: 一个float型的变量赋值1170601,加上19000000,结果出现错误. 原因: float占用4个字节(32位)存储空间,包括符号位1位,阶码位8位,尾数23位.浮点数精度与它的尾数有 ...

  6. Labview按钮的机械动作

    LabVIEW 对于按钮控件的机械动作提供了六个不同的选择,它们可以通过右键按钮并选择机械动作来找到.这些不同的选项导致按钮输出的值的行为不同.下里将这六个选项做一个简短的总结: 单击时转换当用鼠标将 ...

  7. Unity3d实现幸运转盘

    完成效果 我说一下制作流程,然后再看后面的代码1.创建一个image,选择我们的转盘背景图,素材找我或者网上都有,不多说了哈:2.创建一个空物体,位于转盘的正中心,因为我们的转盘指针的旋转中心是根据空 ...

  8. 【matlab】输出显示函数 sprintf()&disp()

    disp()功能类似于c语言中的print:java语言中的System.out.println(): Matlab的disp()函数  : 1.输出字符串: >>disp('my tes ...

  9. _variant_t和_bstr_t

    _variant_t和_bstr_t这两个类分别封装并管理VARIANT和BSTR这两种数据类型, VARIANT和BSTR这两种类型是COM中使用的数据类型. 实现_variant_t向int,St ...

  10. linux系统中,tee命令的使用

    需求描述: 今天在看nginx内容的过程,遇到了tee这个命令,所以查询了下,在这里记录下使用方法. 操作过程: 1.执行以下的命令 [root@testvm ~]# uname -n | tee h ...