
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
Insert New String Within a String Using MySQL Function
We can use MySQL INSERT() function to insert new string within a string after removing the characters from the original string.
Syntax
INSERT(original_string, @pos, @len, new_string)
Here, original_string is the string in which we want to insert new string at the place of some specific number of characters.
@pos is the position at which the insertion of new string should start.
@len is the number of characters should delete from the original string. The starting point of deletion of characters is value of @pos.
New_string is the string we want to insert into the original string.
Example
mysql> Select INSERT('Yash Sharma',5,7,' Pal'); +----------------------------------+ | INSERT('Yash Sharma',5,7,' Pal') | +----------------------------------+ | Yash Pal | +----------------------------------+ 1 row in set (0.00 sec)
Here in the above example new string ‘ Pal’ has been inserted. The insertion start from 5th character of the original string and this function remove, starting point is 5th character, total 7 characters from the original string.