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 ...
随机推荐
- (数组)Largest Rectangle in Histogram(栈解问题)
Largest Rectangle in Histogram Given n non-negative integers representing the histogram's bar height ...
- C++面试笔记--宏定义
宏定义是一个比较常考的考点,所以我归纳总结了一下近年的宏定义的题目 //宏定义面试题1.cpp//What is the output of the following code?[中国台湾某著名杀毒 ...
- Spring @ResponseBody 返回乱码 的优雅解决办法
版权声明:本文为博主原创文章,未经博主允许不得转载. 目录(?)[+] 返回的结果中,中文全部被问号(?)代替的解决办法: *-servlet.xml的部分配置如下: <bean id=&quo ...
- Java实现终止线程池中正在运行的定时任务
源于开发 最近项目中遇到了一个新的需求,就是实现一个可以动态添加定时任务的功能.说到这里,有人可能会说简单啊,使用quartz就好了,简单粗暴.然而quartz框架太重了,小项目根本不好操作啊.当然, ...
- Spring Boot 学习系列(05)—自定义视图解析规则
此文已由作者易国强授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 自定义视图解析 在默认情况下Spring Boot 的MVC框架使用的视图解析ViewResolver类是C ...
- 读《JavaScript权威指南》笔记(四)--数组、函数
一.数组 1.数组是值的有序集合.每个值叫做一个元素,而每个元素在数组中有一个位置,以数字表示,称为索引.JavaScript数组是无类型的:数组元素可以是任意类型,并且同一个数组中的不同元素也可能有 ...
- SP7258 SUBLEX - Lexicographical Substring Search
\(\color{#0066ff}{ 题目描述 }\) 给定一个字符串,求排名第k小的串 \(\color{#0066ff}{输入格式}\) 第一行给定主串(len<=90000) 第二行给定询 ...
- 平衡树学习笔记(6)-------RBT
RBT 上一篇:平衡树学习笔记(5)-------SBT RBT是...是一棵恐怖的树 有多恐怖? 平衡树中最快的♂ 不到200ms的优势,连权值线段树都无法匹敌 但是,通过大量百度,发现RBT的代码 ...
- win10全半角切换
shift+sapce shift+sapce:全半角切换快捷键,编程的时候发现英文是这种状态,就需要用快捷键切换成半角. (查过老是忘记,在这里写一下记住它)
- 牛客寒假算法基础集训营1 D 小a与黄金街道
链接:https://ac.nowcoder.com/acm/contest/317/D 首先被数学题吓到了.gcd(n,x)==1 那么必定有 gcd(n,n-x)==1 证明略. 并且两个人的对答 ...