Oracle - deleting duplicates

后端 未结 2 1254
暗喜
暗喜 2021-01-28 10:55

I have found the following way for removing duplicates:

DELETE FROM
   table_name A
WHERE
  a.rowid >
   ANY (
     SELECT
        B.rowid
     FROM
        t         


        
2条回答
  •  [愿得一人]
    2021-01-28 11:21

    In Oracle, ROWID is a pseudo column points to the physical location of a row. The query does a self join and fetches those rows which have the same value of column 1 & column 2 - with the assumption that these keys are enough to identify as duplicate row.

    Once the rows are fetched, the query then deletes those rowids which are larger than the first row fetched, thereby deleting duplicates

提交回复
热议问题