Oracle删除重复的数据,Oracle数据去重复
程序员文章站
2023-02-22 12:59:20
oracle 数据库中查询重复数据:
select * from employee group by emp_name having count (*)>...
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);
上一篇: Linux下使用expect命令编写自动化交互脚本
下一篇: Oracle数据加密方法分析