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的更多相关文章

  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 DB: Duplicate Emails

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

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

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

  4. 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 ...

  5. LeetCode DB : Delete Duplicate Emails

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

  6. LeetCode Database: Delete Duplicate Emails

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

  7. leetcode【sql】 Delete Duplicate Emails

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

  8. [SQL]196. Delete Duplicate Emails

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

  9. LeetCode - Delete Duplicate Emails

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

随机推荐

  1. Java的get请求-----接口测试

    package findyou.Interface; import java.net.HttpURLConnection; import java.net.URL; public class URLC ...

  2. JavaScript 测试和捕捉(try与catch)

    JavaScript 测试和捕捉 try 语句允许我们定义在执行时进行错误测试的代码块. catch 语句允许我们定义当 try 代码块发生错误时,所执行的代码块. JavaScript 语句 try ...

  3. kolla-build镜像时,问题汇总

    记录下kolla-build镜像时,遇到的一些问题,既为了方便自己以后问题的查找,也为了帮助别人避免踩这些坑.遇到的问题会持续更新在博客里面. 问题1:使用的kolla 版本是ocata版本,本地已经 ...

  4. SpringMvc文件上传(内部框架版 配置无需考虑 只考虑上传部分)-

    -此版本有一不足:自定义文件路径必须存在,不会自动创建 ,详看how2J

  5. Intent要使用的ACTION都有哪些?在哪里能查到详细的ACTION呢?

    Intent操作结构之一就是ACTION,这些ACTION都有哪些?在哪里能查到详细的ACTION呢? 官方文档: https://developer.android.com/reference/an ...

  6. html颜色设定 - 网址不见了看这里

  7. Harbor安装 -- 企业级Registry仓库

    (一)Harbor安装 -- 企业级Registry仓库 以下文章转自http://www.jianshu.com/p/2ebadd9a323d 根据Harbor官方描述: Harbor是一个用于存储 ...

  8. POJ - 2528Mayor's posters (离散化+线段树区间覆盖)

    The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign h ...

  9. jmeter-Http信息头管理器

    今天遇到的问题是:一个报名接口,用户先要登录后,再去报名.而登录页面:用户名.密码.动态图形验证码,所以不能直接使用jmeter参数传值方法. 测试的时候,需要先登录,获取ticket后,才能去请求下 ...

  10. 对于vue的一些理解

    首先是组件之间的通信方式 父组件到子组件的通信: props和$refs 子组件到父组件的通信: events 和 $parents 以及 $root 组件之间的通信 eventBus和vuex ev ...