Quick an dirty word count using sql

Here’s a quick and dirty way to get the word count of a column with space separated text. The below code counts the number of words in the description column of the article table.

select length(description) - length(replace(description, ' ', ''))+1
from article