Adding a UNIQUE CONSTRAINT to an existing column with duplicate values
GSunMay 23 2013 — edited May 23 2013Hello Oracle Forums, I have a table that contains 11,901 rows. I tried to define the UNIQUE constraint on the xcode column but received an error: the column already contain duplicate values! I issued following SQL 'SELECT COUNT(*) FROM states;' the result is 11,901 and 'SELECT COUNT(DISTINCT (xcode)) FROM states;' the result is 11,680. Hence to enforce this unique key I must remove the 221 rows. Please how can I achieve this?