栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

使用sqlite在列中查找最常见的单词?

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

使用sqlite在列中查找最常见的单词?

您可以使用一个非常丑陋的查询来执行此操作。

select word, count(*) from (select (case when instr(substr(m.comments, nums.n+1), ' ') then substr(m.comments, nums.n+1)  else substr(m.comments, nums.n+1, instr(substr(m.comments, nums.n+1), ' ') - 1)        end) as wordfrom (select ' '||comments as comments      from m     )m cross join     (select 1 as n union all select 2 union all select 3     ) numswhere substr(m.comments, nums.n, 1) = ' ' and substr(m.comments, nums.n, 1) <> ' ') wgroup by wordorder by count(*) desc

这是未经测试的。内部查询需要一个数字列表(此处限制为3;您可以了解如何添加更多数字)。然后检查单词是否在位置n +
1处开始。空格后是一个单词,所以我在注释的开头加了一个空格。

然后,出于聚合目的将其删除。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/414806.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号