how to replace part of a string with another string in MySQL
Use the MySQL REPLACE() function to replace a substring (i.e. words, a character, etc.) with another substring and return the changed string. This function takes three arguments:
- The string to change. (In our example, it’s the column
- The substring to replace (i.e. the character ‘-’).
- The substring to insert (i.e. the character ‘/’).
Notice that this function replaces all occurrences of the substring in the given string or column. In our example, each part_number contains three hyphen characters, each one of which was replaced by a slash.