Detailed explanation of the method of deduplicating duplicate data in Oracle table
Detailed explanation of the method of deduplicating duplicate data in Oracle table
We will definitely encounter a situation in the project, that is, there is no primary key in the table, or there is duplicate data in the table, but some fields have duplicate data, and we need to filter out the duplicate data.
Here is a solution
Delete from mytest ms where rowid in (select aa.rid from (select rowid as rid, row_number () over (partition by s.name order by s.id) as nu from mytest s) aa where aa.nu > 1)
Row_number () over is an analysis function that can get the number of occurrences of the current packet. If there is any repetition, it will add up to 2pr 3pl 4. If we delete anything larger than 1, we can delete it through rowid.
The above is the introduction of Oracle de-duplication methods and simple examples, there are many articles about the database on this site, welcome to search and read, thank you for reading, hope to help you, thank you for your support!