This can be a super useful SQL statement when fro example migrating a WordPress website manually, or after importing tables from another WordPress website. The few statements below will suffice for a WordPress migration. Although if you have plugins that create their own tables in the database you may need to update this as well.

General syntax of the SQL find and replace statement

UPDATE tablename SET tablefield = replace(tablefield,"findstring","replacestring");

//Posts and Page content replacement
UPDATE wp_posts SET post_content = replace(post_content,"findstring","replacestring");

//Posts and Page permalink replacement
UPDATE wp_posts SET guid = replace(tablefield,"findstring","replacestring");

//Post metadata
UPDATE wp_postmeta SET meta_value = replace(meta_value,"findstring","replacestring");

// Site Address and other Core WordPress site options
UPDATE wp_options SET meta_option = replace(meta_option,"findstring","replacestring");