I have a table which contains articles on movies. Each article has a title and many of them have common phrases in them.

I would like to do some analysis on the data and extract these common phrases along with a count of their usage.

Here is a simple example:

John cannot connect to Asian number
The backup service cannot connect to the client
Mary cannot connect her laptop to the network

From this data I would like to be able to extract the following:

Phrase                                             Count
-------------------------------------------------- -------
cannot connect                                     3
cannot connect to                                  2

My database is in MySQL and I'm using php to code. Any kind of help will be appreciated.


Use your application code to extract "phrases" and store them in a table. Then do SELECT ... GROUP BY ... to generate the counts in question.

No, it is not practical to do this entirely in SQL. SQL is limited in its text parsing ability.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.