
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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
Replace Substring in MySQL String
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)
Advertisements