mysql - Counting most common word in SQL table with exclusions -
mysql - Counting most common word in SQL table with exclusions -
i'm trying count mutual words table total of text (strings) in mysql database (using mysql workbench). got code working reading post (written kickstart). code uses separate table called integer 10 columns 0 9 counting.
table schema main table. i'm interested in info "text" column.
'id', 'int(11)', 'no', 'pri', '0', '' 'postid', 'int(11)', 'yes', 'mul', null, '' 'score', 'int(11)', 'yes', 'mul', null, '' 'text', 'varchar(4000)', 'yes', '', null, '' 'creationdate', 'varchar(25)', 'yes', '', null, '' 'userid', 'int(11)', 'yes', 'mul', null, '' 'userdisplayname', 'varchar(255)', 'yes', '', null, '' sql query:
select aword, count(*) wordoccurancecount (select substring_index(substring_index(concat(text, ' '), ' ', acnt), ' ', -1) aword table cross bring together ( select a.i+b.i*10+c.i*100 + 1 acnt integers a, integers b, integers c) sub1 (length(body) + 1 - length(replace(text, ' ', ''))) >= acnt) sub2 sub2.aword != '' grouping aword order wordoccurancecount desc limit 10 it lists out top 10 words, total of short words a, the, you, me... etc. how can alter skip words those? how can create say, words 5 characters , counted?
schema of integers table 'i', 'int(11)', 'no', 'pri', null, ''
original post , code taken post. new , couldn't post on had inquire here. determining used set of words php mysql
thank much help!
you should able add together status clause:
select aword, count(*) wordoccurancecount (select substring_index(substring_index(concat(text, ' '), ' ', acnt), ' ', -1) aword table cross bring together ( select a.i+b.i*10+c.i*100 + 1 acnt integers a, integers b, integers c) sub1 (length(body) + 1 - length(replace(text, ' ', ''))) >= acnt) sub2 sub2.aword != '' , length(sub2.aword) >= 5 grouping aword order wordoccurancecount desc limit 10 just checking see if length of aword @ to the lowest degree 5 chars, , if so, include in result set. limit applied result set (post-filtering) , should have need.
mysql sql
Comments
Post a Comment