1、查找表中多余的重复记录(根据单个字段studentid)
 
select * from table_name where studentid in (select studentid from table_name group by studentid having count(studentid) > 1)
 
2、查找表中多余的重复记录(根据多个字段studentid,name...)
 
select * from table_name a where (a.studentid,a.name) in(select studentid,name from 表 group by studentid,name having count(*) > 1)
 
3、删除表中多余的重复记录(根据单个字段studentid)
 
delete from table_name a where a.studentid in( select studentid from table_name group by studentid having count(studentid) > 1)
 
4、删除表中多余的重复记录(根据多个字段studentid,name...)
 
delete from table_name a where (a.studentid,a.name) in( select studentid,name from table_name group by studentid,name having count(*) > 1)
 
5、删除表中多余的重复记录(根据单个字段studentid),只保留id最小的记录
 
delete from table_name a where a.name in( select name from table_name group by id having count(name) > 1)
and a.id not in (select min(id) from table_name group by name having count(*) > 1)
 
6、删除表中多余的重复记录(根据多个字段name,studentid...),只保留id最小的记录
 
delete from table_name a where (a.name,a.studentid) in (select name,studentid from table_name group by name,studentid having count(*) > 1)
and a.id not in (select min(id) from table_name group by name,studentid having count(*)>1)

Oracle学习笔记(1)——查询及删除重复数据的更多相关文章

  1. MySQL查询和删除重复数据

    删除表中重复记录,只保留一条: delete from 表名 where 字段ID in (select * from (select max(字段ID) from 表名 group by 重复的字段 ...

  2. 吴裕雄--天生自然python学习笔记:pandas模块删除 DataFrame 数据

    Pandas 通过 drop 函数删除 DataFrarne 数据,语法为: 例如,删除陈聪明(行标题)的成绩: import pandas as pd datas = [[65,92,78,83,7 ...

  3. Office365学习笔记—列表查询,删除条目,更新条目。

    1,基于Query语句的列表查询. function retrieveListItems(itemId) { var siteUrl=_spPageContextInfo.webServerRelat ...

  4. Oracle查询及删除重复数据

    1.查找表中多余的重复记录,重复记录是根据单个字段(Id)来判断 ) 2.删除表中多余的重复记录,重复记录是根据单个字段(Id)来判断,只留有rowid最小的记录 ) ); 3.查找表中多余的重复记录 ...

  5. Oracle 学习笔记 常用查询命令篇

    1.查询某个用户下有多少张表 有时候很有用  select count(*) from dba_tables t where t.owner='SCOTT';

  6. T-SQL技术收集——删除重复数据

    原文:T-SQL技术收集--删除重复数据 在工作和面试中,经常出现如何查询或者删除重复数据的问题,如果有主键,那还好办一点,如果没有主键,那就有点麻烦. 当一个表上没有辅助键时,如果使用SSMS界面来 ...

  7. Oracle 查询并删除重复记录的SQL语句

    查询及删除重复记录的SQL语句 1.查找表中多余的重复记录,重复记录是根据单个字段(peopleId)来判断select * from peoplewhere peopleId in (select  ...

  8. oracle 查询及删除重复记录的SQL语句

    查询及删除重复记录的SQL语句 1.查找表中多余的重复记录,重复记录是根据单个字段(Id)来判断 select * from 表 where Id in (select Id from 表 group ...

  9. Oracle学习笔记三 SQL命令

    SQL简介 SQL 支持下列类别的命令: 1.数据定义语言(DDL) 2.数据操纵语言(DML) 3.事务控制语言(TCL) 4.数据控制语言(DCL)  

随机推荐

  1. 前Google人谈团队管理:针对不同员工的情境管理法和如何选择合理的团队规模

    本文作者Tomasz Tunguz是Redpoint Ventures的风险投资人,曾在Google担任产品经理并参与过AdSense项目. 我有一个朋友,他创立了一家很成功的公司,而且还在迅速发展. ...

  2. js获取名字为XX的标签

    $("input[name='XX']"); <input name="address_select" type="radio" va ...

  3. [core java学习笔记][第六章接口与内部类]

    接口域内部类 接口 描述类具有什么功能,不给出具体实现. 内部类 用于设计协作关系的类集合 代理 实现任意接口的对象. 6.1 接口 接口声明 public interface Comparable ...

  4. echarts演示笔记

    http://echarts.baidu.com/doc/start.html 1.新建一个echarts.html文件,为ECharts准备一个具备大小(宽高)的Dom. <!DOCTYPE ...

  5. AngularJS Directive - 开场小介绍(转)

    Directive其实就是让html变得更强大的一种方法.它可以根据需求对dom变形,或注入行为. 觉得它很神秘么,其实一点儿也不神秘,只要开始使用AngularJS了,就一定在使用着Directiv ...

  6. Android WebView 软键盘挡住输入框

    解决方法一: 在所在的Activity中加入 getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RES ...

  7. 面试总结之html+css

    最近面试了一些公司,和技术总监聊了一些前端技术方面的内容.回来之后我总结了一下,大致可以分为三个模块:第一.Html与css 方面:第二.浏览器解析方面:第三.js方面.打算,分为三篇博文,根据自己的 ...

  8. winform窗体中查找控件

    private RichTextBox FindControl()        { RichTextBox ret = null;            try            {       ...

  9. CDMA电信短信猫支持189等电信号码可二次开发

    CDMA电信短信猫支持189等电信号码可二次开发 这款短信猫采用法国wavecom Q2358C模块,支持短信猫二次开发,可提供短信猫二次开发包下载测试.提供相关资料文档. 此款CDMA电信短信猫有串 ...

  10. 自己对WSO2 ESB 见解

    这周没想到要更新什么内容,就把我最近工作接触的WSO2 ESB简单介绍下吧.     前提: 一切文档,知识都要与官方文档为准. WSO2 ESB: http://wso2.com/products/ ...