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. LeetCode第136题:只出现一次的数字

    问题描述 给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次.找出那个只出现了一次的元素. 说明: 你的算法应该具有线性时间复杂度. 你可以不使用额外空间来实现吗? 示例 1: ...

  2. wordcount程序实现与测试

    GitHub地址 https://github.com/jiaxuansun/wordcount PSP表格 PSP PSP阶段 预估耗时(分钟) 实际耗时(分钟) Planning 计划 10 5 ...

  3. 《Head First Servlets & JSP》-8-无脚本的JSP

    以前servlet和JSP交互的代码 servlet代码示例: JSP代码示例: 若属性不是一个String而是一个Bean呢? 一个简单的JavaBean servlet代码示例: JSP代码示例: ...

  4. CIFAR-10 模型

    Code: https://github.com/tensorflow/models/tree/master/official/resnet Data: http://www.cs.toronto.e ...

  5. WebGoat系列实验Buffer Overflows & Code Quality & Concurrency

    WebGoat系列实验Buffer Overflows & Code Quality & Concurrency Off-by-One Overflows 实验需要访问OWASP Ho ...

  6. [raspberry pi3] raspberry 充当time machine

    之前是用硬盘直接当timemachine的,看到有人用raspberry+硬盘充当timemachine的 自己的也搞了下,还是蛮方便的,下面是具体的步骤 1.安装必要的服务 sudo apt-get ...

  7. c# 字符串填充占位

    C#  字符串PadLeft函数的使用 1.Demo: 需求: 将111改变成0000111 使用字符串PadLeft函数可以解决: int num = 111; string s= num.ToSt ...

  8. ubuntu - 14.04,配置GOPATH(GO语言开发代码存放目录)

    一,创建GOPATH:选择一个目录或者在我们想要的地方创建一个作为GOPATH的目录,我的GOPATH是:“/home/sunylat/gopath”. 二,配置系统变量:在shell里面输入“sud ...

  9. [haut] 1281: 邪能炸弹 dp

    题目描述 正在入侵艾泽拉斯的古尔丹偶然间得到了一颗邪能炸弹,经过研究,他发现这是一颗威力极其巨大且难以控制的炸弹.但是精通邪能的古尔丹突然有了一个大胆的想法,他对炸弹进行了一些小小的改造.这使得炸弹需 ...

  10. [比赛|考试]nowcoder NOIPpj组第二场

    nowcoder NOIPpj组第二场 370pts/400pts(100,100,100,70) rank3 给自己的反思:前3题都A了,T4O(N^2)不会就是不会(没准是我懒得推了),DP了70 ...