
- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we replace all the occurrences of a substring with another substring within a string in MySQL?
MySQL REPLACE() function can replace all the occurrences of a substring with another substring within a string.
Syntax
REPLACE(str, find_string, replace_with)
Here
- Str is a string which have the substring.
- Find_string is a substring which is present one or more times within the strung str.
- Replace_with is a substring which will replace every time it finds find_string within str.
Example
mysql> Select REPLACE('Ram, My Name is Ram', 'Ram', 'Shyam'); +------------------------------------------------+ | REPLACE('Ram, My Name is Ram', 'Ram', 'Shyam') | +------------------------------------------------+ | Shyam, My Name is Shyam | +------------------------------------------------+ 1 row in set (0.00 sec)
- Related Questions & Answers
- Replace substring with another substring C++
- How to replace all occurrences of a string with another string in Python?
- How can we extract a substring from a string in MySQL?
- How to replace all occurrences of a word in a string with another word in java?
- Return a copy of the string with all occurrences of substring old replaced by new in Numpy
- In MySQL, how can we insert a substring at the specified position in a string?
- How can we get substring from a string in Python?
- Get the first occurrence of a substring within a string in Arduino
- Get the last occurrence of a substring within a string in Arduino
- Count occurrences of a substring recursively in Java
- How to replace all occurrences of a string in JavaScript?
- Find if a substring exists within a string in Arduino
- How can we extract a substring from the value of a column in MySQL table?
- In MySQL, how can we pad a string with another string?
- How to check if string or a substring of string starts with substring in Python?
Advertisements