Menu Close

Replace strings in SQL tables by query

Sometimes you need to fix some information or data in a table with SQL. Here some examples of queries I used to fix or change data. Example template:

UPDATE `table_name` SET `field_name` = replace(same_field_name, 'unwanted_text', 'wanted_text')

Using this example template to replace a specific string in WordPress database posts:

UPDATE `wp_posts` SET `post_content` = replace(post_content, '', '')

Leave a Reply

Your email address will not be published. Required fields are marked *