LeetCode - Delete Duplicate Emails
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的更多相关文章
- [LeetCode] Delete Duplicate Emails 删除重复邮箱
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- LeetCode——Delete Duplicate Emails(巧用mysql临时表)
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- Leetcode 182. Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- LeetCode Database: Delete Duplicate Emails
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- leetcode【sql】 Delete Duplicate Emails
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- LeetCode DB : Delete Duplicate Emails
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- leetcode 196. Delete Duplicate Emails 配合查询的delete
https://leetcode.com/problems/delete-duplicate-emails/description/ 题意要对原来的数据表进行删除,不删除不行,它每次只输出原来那个表. ...
- LeetCode 196. Delete Duplicate Emails (删除重复的电子邮箱)
题目标签: 题目给了我们一个 email 的表格,让我们删除重复的. 建立Person p1,Person p2,当email 相同时,而且 p1 id 要大于 p2 id 时候,删除这一行. Jav ...
- 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 ...
随机推荐
- IOS中摇一摇实现截屏(可实现问题反馈的功能)
有一段时间没有更新博客了,今天更新一篇关于最近工作中用到的一个功能,先简单描述一下:我们知道,测试人员在测试客户端产品时,当出现问题或者BUG的时候,都得先对页面截图,然后从相册中选择截图,加上一段描 ...
- HTML(一):HTML基本元素标签
一.什么是HTML HTML(Hypertext Markup Language):即超文本标记语言,是一种用来设计网页的标记语言,用该语言编写的文件,以.html或.htm为后缀,并且由浏览器解释执 ...
- el 表达式 强制类型转换
el 表达式 强制类型转换 今天有人问我了这个问题 jsp页面中,能否实现 <% request.setAttrites("a","1234"); % ...
- 使用JPedal取代PDFBox
http://wanggp.iteye.com/blog/1144177 ———————————————————————————————————————————————— 之前都是使用PDFBOX0. ...
- imx6 读取CPU温度
imx6 读取CPU温度 cat /sys/class/thermal/thermal_zone0/temp Tony Liu 2017-2-11, Shenzhen
- page指令属性简要介绍:
page指令属性简要介绍: language=”java” 声明脚本语言的种类,暂时只能用”java” extends=”package.class” 标明JSP编译时需要加入的Java Class的 ...
- QTableWidget的表头颜色设置
设置水平和垂直表头的颜色ui->tableWidget->horizontalHeader()->setStyleSheet("QHeaderView::section{b ...
- alien 进行rpm 包和deb 包之间的转换
今天安装一个pandoc, 官方只提供了一个deb 的二进制包,为了在redhat 上安装,需要将deb 包转换成rpm 包. 使用工具alien : http://ftp.de.debian.org ...
- C#获取并修改文件扩展名的方法
本文实例讲述了C#获取并修改文件扩展名的方法.分享给大家供大家参考.具体分析如下: 这里使用C#编程的方法改变文件扩展名的文件,必须使用Path类. Path类用来解析文件系统路径的各个部分.静态方法 ...
- apache Storm之一-入门学习
准备工作 这个教程使用storm-starter项目里面的例子.我推荐你们下载这个项目的代码并且跟着教程一起做.先读一下:配置storm开发环境和新建一个strom项目这两篇文章把你的机器设置好. 一 ...