We can use the MySQL INSERT() function to insert a substring at a specified position in a string.
INSERT(original_string, @pos, @len, new_string)
Here, original_string is the string in which we want to insert a new string at a specific number of characters.
mysql> Select INSERT('MySQL Tutorial',7,8,'@Tutorialspoint'); +------------------------------------------------+ | INSERT('MySQL Tutorial',7,8,'@Tutorialspoint') | +------------------------------------------------+ | MySQL @Tutorialspoint | +------------------------------------------------+ 1 row in set (0.00 sec)
In the above example, the new string "@Tutorialspoint" has been inserted. Insertion starts at character 7 of the original string, and this function deletes starting point at character 7, for a total of 8 characters in the original string.
The above is the detailed content of In MySQL, how to insert a substring at a specified position in a string?. For more information, please follow other related articles on the PHP Chinese website!