0

Heading

In mysql, I have a table contains two columns, one is the productID and the other one is the reviews for this specific product(reviews are one or two sentences). table is like this:

Productid  |  reivew 
------     | ------ 
ciwnfien   | Read between the lines. The visual is what you ar... 
ackjdsnfi  | This planner has helped our family    become so much... 
asinfnn    | I adore this book - What I like most  is that it i... 
.....         .....

I want to create another table by Productid that has five extra columns that each shows the most frequent word used to describe that product. the result I am expecting would be like:

Productid  |   word 1   |   word 2   |   word 3  |   word 4     |   word 5
djneihev   |   good     |  useful    | quick     | expensive    |   light
zknwoduc   |   nice     | convenient | cheap     |User-friendly |   common
sqnowsf    | low-quality|  awful     |  bad      |  too cheap   | dangerous 

Please also tell me how to get rid of "stop words" such as "and", "the".(avoid them in the result) Thanks!!!

Ivery
  • 11
  • 4
  • Apart from including what you've tried so far, you shouldn't do this in mysql as that's a job for whatever language you use to extract this data. – deW1 Sep 08 '16 at 23:01
  • I can't do it through mysql? is there any way else can do it? Thanks! – Ivery Sep 08 '16 at 23:05
  • I'm not saying you can't, I'm saying you shouldn't. You can modify this answer to make it work for you http://stackoverflow.com/questions/12344795/count-the-number-of-occurences-of-a-string-in-a-varchar-field – deW1 Sep 08 '16 at 23:12

0 Answers0