mysql remove characters from string code example

Example 1: mysql replace a character in a string

UPDATE users SET first_name = REPLACE (first_name, 'search', 'replace_with') where id > 0;

Example 2: mysql replace

REPLACE(str, find_string, replace_with)

Example 3: how to remove characters from string in mysql

#query 
UPDATE tableName SET columnName = REPLACE(columnName, 'charactersToBeReplaced', 'charactersToBeReplacedWith');

#you can use like this
UPDATE student_enroll_data SET student_name = REPLACE(student_name, '-gyg-', '');

Tags:

Sql Example