Faqts

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

6 of 10 people (60%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

What? Creating an index can remove duplicates?

Dec 29th, 2008 15:17
haytham ali, 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://dir.msryat.org
http://up.msryat.org
http://forums.msryat.org
http://msryat.org/egypt
http://msryat.org/egypt/1.htm
http://msryat.org/egypt/2.htm
http://msryat.org/egypt/3.htm
http://msryat.org/egypt/4.htm
http://msryat.org/egypt/5.htm
http://msryat.org/egypt/6.htm
http://msryat.org/egypt/7.htm
http://games.msryat.org
http://forums.msryat.org/forumdisplay.php?f=30
http://forums.msryat.org/forumdisplay.php?f=38
http://forums.msryat.org/forumdisplay.php?f=31
http://forums.msryat.org/forumdisplay.php?f=49
http://forums.msryat.org/showthread.php?t=21741
http://forums.msryat.org/showthread.php?t=18403
http://forums.msryat.org/showthread.php?t=18457
http://forum.5ligi.com
http://forum.4kwt.com
http://forums.msryat.org/showthread.php?t=21577
http://msryat.org
http://3rabstarz.com/vb