Oracle删除重复的数据,Oracle数据去重复

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

Oracle删除重复的数据,Oracle数据去重复

  2020-12-17 我要评论
这篇文章主要介绍了Oracle删除重复的数据,Oracle数据去重复,需要的朋友可以参考下

Oracle  数据库中查询重复数据:

select * from employee group by emp_name having count (*)>1;

 Oracle  查询可以删除的重复数据

select t1.* from employee t1 where (t1.emp_name) in (SELECT t2.emp_name from employee t2 group by emp_name having count (*)>1) and t1.emp_id not in (select min(t3.emp_id) from employee t3 group by emp_name having count (*)>1);

Oracle 删除重复数据

delete from employee t1 where (t1.emp_name) in (SELECT t2.emp_name from employee t2 group by emp_name having count (*)>1) and t1.emp_id not in (select min(t3.emp_id) from employee t3 group by emp_name having count (*)>1);

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们