faqts

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 9 people (56%) answered Yes
Recently 5 of 9 people (56%) answered Yes

Entry

What? Creating an index can remove duplicates?

May 12th, 2008 21:21
i can do it, Mike Chirico, http://sourceforge.net/project/showfiles.php?group_id=79320&package;_id=115696


Remove duplicate entires.  Assume the following table and data.
              CREATE TABLE IF NOT EXISTS dupTest (          
                pkey int(11) NOT NULL auto_increment,        
                a int,                                       
                b int,                                       
                c int,                                       
                timeEnter timestamp(14),                     
               PRIMARY KEY  (pkey)                           
               );
               insert into dupTest (a,b,c) values (1,2,3),(1,2,3),
                  (1,5,4),(1,6,4);
Note, the first two rows contains duplicates in columns a and b. It 
contains other duplicates; but, the following index leaves the other 
duplicates alone.
          mysql> ALTER IGNORE TABLE  dupTest ADD UNIQUE INDEX(a,b);
For more detail on this example see TIP 5, from the source URL.
http://www.stupidarticles.com
http://www.halazona.com
http://www.shikapika.com
http://www.stakoza.com
http://www.uploadarticles.com
http://www.ganazat.com
http://www.damima.com
http://www.tarabiza.com
http://www.articlesxarticles.com
http://www.articlesfreedirectory.com