如何计算使用Java在数据库中生成的特定单词的次数? [英] How Can I Count Number Of Times The Specific Word Occured In Database Using Java?
本文介绍了如何计算使用Java在数据库中生成的特定单词的次数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
please help me to solve this problem.
i want to count number of times the specific word occured in database using java?
for example, my database c-ram contains
Words
john smith john, mary jones, mary john albert
[Words is the field name in c-ram table]
i want to check how many times "john" occured in c-ram.
i have checked coding without query too, but i cant find the solution. if i use this below query i get same query as output, also i can't to use integer varible to assign for this query.
for(int jm=0;jm<ij;jm++)
{
String query1 = null;
for(int k=0;k<ikm;k++)
{
if(word[jm].contains(item1))
{
query1="SELECT COUNT(*) FROM c_ram WHERE Words = item";
}
help me to get answer with or woithout using query. thanks in advance.
推荐答案
您需要编写一个查询,检查您的数据库是否包含该特定值,当发现为true时,它会增加一个计数器值。
检查这些查询:
Java MySQL检查数据库中是否存在值 [ ^ ]
All you need to write a query that should check whether your db contains that specific value, when finds true it will increase a counter value.
Check these queries:
Java MySQL check if value exists in database[^]
这篇关于如何计算使用Java在数据库中生成的特定单词的次数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文