Search and Replace table field in MySQL database
Sponsored AdsIts really easy to update any table field if you want to get rid of any substring from all the table field of mysql or if you want to replace one string to other string in the table field.
If you are using PHPADMIN the following steps can be helpful to replace or remove a string from table.
- 1. Select the database
- 2. Go the MySQL tab
- 3. Type the SQL query
UPDATE `tablename` SET tablefield= replace(tablefield,”string1″,”string2″)
If you want to remove the string . e.g in the following query string “abc” would get removed from the name field of student table
UPDATE `student` SET name= replace(name,”abc”,”")
you can also use where query with the above sql query
UPDATE `student` SET name= replace(name,”abc”,”") where id = 100;
The above sql can also be executed from mysql command line
Related Posts:
Tags: phpadmin, SET, SQL, SQL Interview Questions, UPDATE
Most Searched