How to Delete Duplicate Records
Lot of oracle developer ask this simple question :
How do i delete the same / duplicate records in my table?
Usually duplicate records happend when there was no constraints in your table. So what we need to do to delete this duplicate records?
Basically its very simple, you just run this query to delete the duplicated records. Example i have employee table with empno as my unique column.
So, the query to delete duplicate records in my employee table should be :
delete employee a
where a.rowid>(select min(rowid)
from employee b
where a.empno=b.empno);
So, what is rowid actually? A rowid is a pseudo column that uniquely identifies a row within a table, but not within a database. So it must be unique value in that rowid. We used it as a key to delete our duplicate records.
Popularity: 5% [?]


