Can we delete duplicate rows using analytical functions? I mean using row_number()
or rank
or dense_rank() in Sql query in Oracle?
You can use ROW_NUMBER()
over a partition of columns that should be unique for you, e.g: ROW_NUMBER() OVER (PARTITION BY COLUMN1, COLUMN2 ORDER BY COLUMN1)
. Every result that has a rownumber > 1 is a duplicate.
You can then for example return the rowid's for those and delete them.