MySQL Tricks

Interesting things you can do with MySQL

Count Number of Words in MySQL

This can easily be achieved by counting the spaces in the text:

SELECT SUM(LENGTH(column_with_text) - LENGTH(REPLACE(column_with_text, ' ', '')) + 1) FROM my_table;

Convert Column to UTF8

CONVERT(CAST(CONVERT(column USING latin1) AS BINARY) USING utf8)