I have this table below which has two columns, being id
and description
:
CREATE TABLE myBigTable (
id INT(11) AUTO_INCREMENT PRIMARY KEY,
description TEXT NOT NULL
)
After inserting some records, I made a simple select and resulted in this below:
+----+-----------------------+
| id | description |
+----+-----------------------+
| 1 | joão de santo cristo |
| 2 | eduardo e mô nica |
| 3 | santo cristo joão |
| 4 | cristo tadeu joão |
| 5 | juazeiro do joão |
+----+-----------------------+
I would like a select to return the number of times each word appears in a given column, such as in the description
column. Below is the return in which it would be desired, containing the word and the quantity. See:
+------------+----------+
| work | qnt |
+------------+----------+
| joão | 4 |
| cristo | 3 |
| santo | 2 |
| ... | ... |
+------------+----------+
I made a small test using LIKE, however I have to put the word I want it to return to.
SELECT count(*) as qnt FROM 'phrase' WHERE description LIKE "%joao%"
Return:
+----------+
| qnt |
+----------+
| 4 |
+----------+
How would a select be to return the words that pop up in a particular column? Is it possible to do this using only database resources?
Note: would not necessarily have to be the number of times a word appears, but rather, if possible, the number of rows it is. >