MySQL Hack: Storing Only the UNIQUE Records In a Table and deleting the rest!by Nishant Arora on 27/10/2011
so the data is simply “Search Term” and “Corresponding Link” like “Rafta Rafta” and “http://pksongsdownload.org/search.php?search=Rafta%2cRafta&type=mp3&page=1“
CREATE TABLE new_table as SELECT * FROM old_table WHERE 1 GROUP BY column_name;
DROP TABLE old_table;
RENAME TABLE new_table TO old_table;
execute after all data is added, so I will explain how this works
- CREATE TABLE new_table as SELECT * FROM old_table WHERE 1 GROUP BY [column to remove duplicates by]; =>> this will create a new table based on the previous table, by selecting unique records based upon a particular column called column_name.
- DROP TABLE old_table; =>> this will kill the old table, so we are left with only the unique one.
- RENAME TABLE new_table TO old_table; =>> Simply rename the new table to old table, and you are done.
Incoming search terms:www h p name-nishant com | select @@version mysql hacks |
Some Other Random Posts: