leetcode 196. Delete Duplicate Emails 配合查询的delete
https://leetcode.com/problems/delete-duplicate-emails/description/
题意要对原来的数据表进行删除,不删除不行,它每次只输出原来那个表。
所以我一直用select测试,这样是永远都不行的。
首先应该对join或者子查询要熟悉,即使不会删除,也要知道怎样选出不合法、合法的出来。
特别注意的是,数据库的,你from什么表,那么就只能对那个表进行改动。
所以如果是from one join two,那个这个是一个新的临时表,需要改名后才能用。
如果是from XXX as one, YYY as two
那么你可以用one或者two
delete p1
from Person as p1, Person as p2
where p1.Email = p2.Email and p1.Id > p2.Id;
leetcode 196. Delete Duplicate Emails 配合查询的delete的更多相关文章
- [LeetCode] Delete Duplicate Emails 删除重复邮箱
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- LeetCode DB: Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
- 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 ...
- LeetCode DB : Delete Duplicate Emails
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...
- 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 ...
- [SQL]196. 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
Discription:Write a SQL query to delete all duplicate email entries in a table named Person, keeping ...
随机推荐
- HttpServletRequest和ServletRequest的区别.RP
问题: 请问HttpServletRequest和ServletRequest的区别? 回答: servlet理论上可以处理多种形式的请求响应形式 http只是其中之一 所以HttpServletRe ...
- Bootstrap 组件之 Nav
一.简介 Nav 指导航页.这里 是一个线上例子. 使用了 .nav 的标签就是一个 Nav.下面举例. {注意} 记住,下面的几种导航页都依赖 .nav. 二.导航页 添加 .nav-tabs. & ...
- 关于 windows mobile 进程操作的方法
#region Process class /// <summary> /// Summary description for Process. /// </summary> ...
- POJ 2836 Rectangular Covering (状压DP)
题意:平面上有 n (2 ≤ n ≤ 15) 个点,现用平行于坐标轴的矩形去覆盖所有点,每个矩形至少盖两个点,矩形面积不可为0,求这些矩形的最小面积. 析:先预处理所有的矩形,然后dp[s] 表示 状 ...
- ipa包使用命令上传fir.im或者蒲公英
我们的工程做了自动打包处理,但是每次打完ipa后只是放置于一个共享盘或者本地,为了方便测试,每次都要手动上传上传fir或者蒲公英,比较麻烦.所以研究了一下怎么能在打完包后直接脚本上传到上传fir或者蒲 ...
- 【zookeeper】
window下安装zookeeper三结点集群: 1:解压缩zookeeper压缩包:复制三分并且命名成:Server_A Server_B Server_C 2:拷贝conf目录下的文件zoo ...
- JavaScript 判断 Undefined 类型
var cookiestr = ''; chrome.cookies.getAll( { 'url': 'https://mp.weixin.qq.com', 'secure': true }, fu ...
- ubuntu - 14.04,如何操作Gnome的任务栏?
搜索到的答案: in gnome classic you must press both the Alt & Super keys at the same time while right-c ...
- 解决VMware Workstation 不可恢复错误: (vcpu-0)
转载:http://tieba.baidu.com/p/3487673152 如图的错误 如果你按照破解了mac支持的VMware Workstation 11的新建虚拟机向导一步一步创建了一个mac ...
- Python中logging模块的基本用法
在 PyCon 2018 上,Mario Corchero 介绍了在开发过程中如何更方便轻松地记录日志的流程. 整个演讲的内容包括: 为什么日志记录非常重要 日志记录的流程是怎样的 怎样来进行日志记录 ...