How to Find and Replace Text in MySQL Table using SQL
by Gabi SolomonThe database engine MySQL has a string function called REPLACE that performes similar to the php function str_replace(). This really comes in handy when you want a certain text replaced in a table data, either being a name or a certain uinique number or maybe some speling mistake.
Syntax
REPLACE(str,from_str,to_str)
Returns the string str with all occurrences of the string from_str replaced by the string to_str. REPLACE() performs a case-sensitive match when searching for from_str.
This function is multi-byte safe.
Examples:
update `orders_table` set `traking_id` = replace(`traking_id`, ‘1111111’, ‘999999999’);
// this will replace all the 1111111 with 999999999 in the table orders_table for the column traking_id
SELECT REPLACE(’www.mysql.com’, ‘w’, ‘Ww’);
Above statement will return ‘WwWwWw.mysql.com’ as result.
It is easy to work around a web development software, all you need to know is the basis of website design. Hire a web design manager if you cannot figure that out and proceed with website hosting. Once done with that, you can move on with internet marketing.
Related Posts
-
Mchidgey

