DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Desirae has posted 3 posts at DZone. View Full User Profile

Remove Duplicate Entries From MySQL Database

01.14.2010
| 583 views |
  • submit to reddit
        // Example: used to remove duplicate zip/postal codes from a table with 5 columns: id, zip, latitude, longitude, country

ALTER IGNORE TABLE zipcode_table ADD UNIQUE INDEX dupidx (zip, country);
ALTER TABLE zipcode_table DROP INDEX dupidx