'Wordpress post content has line breaks instead of paragraphs (Database solution sought)

Whilst this may appear to be a duplicate of WordPress content is using br instead of p, I would like to find an answer that sorts this out at the the database level.

I have imported around 400 posts and, for whatever reason, the content is separated with single line breaks instead of double line breaks.

I'm out of my depth with SQL but I'd like to replace this within the database.

I've got this;

SELECT REPLACE(`post_content`, '\n', '\n\n') FROM `wp_posts`

but there are two issues, one is this correct? before running on a table that has 4,000 rows and second, how do I ensure that I don't end up with \n\n\n\n in, for instance, pages that are correct?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source