Monday, September 7, 2020

MySQL: Find and Replace Data in Column / Field

Replace ONE character with ANOTHER
UPDATE words set word = REPLACE(word,'á','a')
UPDATE words set word = REPLACE(word,'í','i')
UPDATE words set word = REPLACE(word,'é','e')
UPDATE words set word = REPLACE(word,'ú','u')
UPDATE words set word = REPLACE(word,'á','a')
UPDATE words set word = REPLACE(word,'ó','o')

https://www.w3resource.com/mysql/string-functions/mysql-replace-function.php

 

Replace NEWLINE with SPACE

UPDATE words SET origin = REPLACE(origin, '\r\n', ' ')  

If it doesn't replace anything, use '\n' instead of '\r\n'.