With the help of an unique index, you can remove duplicate rows very easily with only one or two lines of sql queries.
ALTER IGNORE TABLE cities ADD UNIQUE INDEX dupidx (cityName, countryID, regionID);
You can choose to keep the unique index (to avoid duplicates) or drop it from your table if it’s not needed anymore.
ALTER TABLE cities DROP INDEX dupidx
Leave a Reply