background preloader

Database (MySQL)

Facebook Twitter

Eliminating Duplicate Records From MySQL Tables. Any­one who works with data­base dri­ven devel­op­ment to any extent, will occa­sion­ally run into a sit­u­a­tion where dupli­cate infor­ma­tion is added to their data­base.

Eliminating Duplicate Records From MySQL Tables

I have per­son­ally run into such a prob­lem on many occa­sions since I started work­ing with data­base dri­ven software. Being able to quickly undo data cor­rup­tion is extremely impor­tant in pro­duc­tion data­bases. As much as we like to have a per­fect pro­duc­tion envi­ron­ment; it is often very dif­fi­cult to do ded­i­cate the time and resources nec­es­sary to avoid all mistakes. Locating Duplicate Entries In A MySQL Table. If you don’t have unique indexes on your table, it is likely that you will occa­sion­ally have entries that are dupli­cated.

Locating Duplicate Entries In A MySQL Table

This can often hap­pen because of a soft­ware bug or pos­si­bly a user error. Some appli­ca­tions even choose not to have unique indexes for per­for­mance rea­sons; though this hap­pens at the cost of data integrity. The best I know of, to demon­strate how to locate the dupli­cate entries, is to use an exam­ple. So let’s say you have the fol­low­ing table: 3.3.4.4 Sorting Rows.

Administration (General)

MySQL Cluster. Add Ons. Data Visualization. Performance Tuning. Replication. Visual Thinking.