Find, delete repetition records in the table

xiaoxiao2021-03-06  110

In Oracle, each record has a RowID. RowID is unique in the entire database, and the RowID determines which data file, block, line on the Oracle; in a repetitive record, maybe all The contents of the columns are the same, but the RowId will not be the same, so as long as it is determined that the maximum ROWID has the maximum ROWID, the rest is removed.

Implementation: SQL> Create Table Test

2 Name Varchar (50), 3 Sex varchar2 (2) 4)

5 /
Delete from test a where a.rowid! = (Select max (rowid) from test b where a.name = b.nameand a.sex = b.sex);

转载请注明原文地址:https://www.9cbs.com/read-126361.html

New Post(0)