SQL query to add post meta for each WordPress post

To add post meta to all posts (posts with post type “post”) in your WordPress database you should use the following SQL query:

INSERT INTO wp_postmeta (post_id, meta_key, meta_value)
SELECT ID, 'meta-key', 'meta-value' FROM wp_posts WHERE post_type = 'post';