Oracle如何删除重复数据
在Oracle数据中难免会有一些重复的时间,但是在众多数据中删除重复的是一件非常困难的事情,那么你知道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);
综上所述就是关于Oracle如何删除重复数据的内容,当然您认为写得不好或者有错的地方,希望得到您的建议和指正,谢谢。