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. 通过shell脚本开始和结束守护进程

    //关闭脚本 #!/bin/sh WHOAMI=`whoami` PID=`ps -u $WHOAMI | grep 守护进程名 | awk '{print $1}'` if (用户名 "$ ...

  2. 2013年第四届蓝桥杯省赛试题(JavaA组)

    1.结果填空 (满分3分)2.结果填空 (满分5分)3.结果填空 (满分6分)4.结果填空 (满分13分)5.代码填空 (满分5分)6.代码填空 (满分10分)7.程序设计(满分4分)8.程序设计(满 ...

  3. 42、生鲜电商平台-商品的spu和sku数据结构设计与架构

    说明:Java开源生鲜电商平台中商品的spu和sku数据结构设计与架构,包括数据库图标与架构分析. 1. 先说明几个概念. 电商网站采用在商品模块,常采用spu+sku的数据结构算法,这种算法可以将商 ...

  4. c#创建Table

    private void BindDatazhangting() { DataTable dt = new DataTable(); dt.Columns.Add("channel" ...

  5. vue使用过程常见的一些问题

    Vue目前的的开发模式主要有两种:1.直接页面级的开发,script直接引入Vue2.工程性开发,webpack+loader或者直接使用脚手架工具Vue-cli,里面的文件都配置好了 webpack ...

  6. Python第一次写的代码

    #!/bin/bash/env python # -*- coding:utf-8 -*- #function:输出1-10每隔1秒 import time start = 1 flag = True ...

  7. anularjs前端分页

    var dataList = []; $scope.page = { page:1, pageSize:15, numPerPageOpt:[15,30,50,100], totalNum:0, to ...

  8. Gym - 101845K 排序+概率

    The UNAL programming coaches have lost a bet, they bet the 6 UNAL teams would occupy the first six p ...

  9. [BOI2007]Sequence 序列问题 BZOJ1345

    题目描述 对于一个给定的序列a1, …, an,我们对它进行一个操作reduce(i),该操作将数列中的元素ai和ai+1用一个元素max(ai,ai+1)替代,这样得到一个比原来序列短的新序列.这一 ...

  10. 牛客寒假算法基础集训营1 D 小a与黄金街道

    链接:https://ac.nowcoder.com/acm/contest/317/D 首先被数学题吓到了.gcd(n,x)==1 那么必定有 gcd(n,n-x)==1 证明略. 并且两个人的对答 ...