MySQL queries for update substring and get substring
Replace substring
1 2 3 4 5 6 7 8 |
// Mysql Query // Below code update substring 8 to 2 UPDATE `table_name` SET filed_name=REPLACE(filed_name, '8', '2') WHERE user_id=1 |
Get substring from string
1 2 3 4 5 6 |
//Mysql Query SELECT SUBSTRING_INDEX("www.weanswer.xyz", ".", 1); |
Result: www
More Stories
How to reset or change the MySQL root password?
Incorrect datetime value: ‘0000-00-00 00:00:00’ for column
MySQL String Functions