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相关文章