MySQL : How to do find and replace and remove duplicate entries
Sometimes these small utility codes are really important when you stuck with a large amount of data. These are really straight forward queries.
How to do find a replace:
UPDATE TABLENAME set FIELD = replace(FIELD, 'FIND', 'REPLACE') where instr(FIELD, 'FIND') > 0;
Delete duplicate entries from a table : Adding a unique index do the job.
© Heshan Wanigasooriya.RSS
ALTER IGNORE TABLE TABLENAME ADD UNIQUE INDEX idx\_name (FIELD);
🍪 This site does not track you.