How to Delete Duplicate Rows from Oracle Tables

Let’s see how we can delete the duplicate rows in a table. First we need to find the duplicated records by comparing/grouping columns, then we’ll use ROWID to separate the rows.

Here’s a script to generate the sample table:

In this table, column named “no” is unique, but I’ll use ROWID to identify the rows. I’ve added this column to show which records will not be deleted.

Let’s remove the duplicate rows:

Here’s the result after deleting rows:
NO NAME PHONE
——————————
1 GOKHAN 232-4446735
4 TOM 800-4446735
7 MIKE 900-4446735