查询计数字SQLite 3

编程入门 行业动态 更新时间:2024-10-18 16:42:51
本文介绍了查询计数字SQLite 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有办法计算文本字符串中的单词?

Is there a way to count words in a text string?

我使用SQLite 3,我试图写一个查询,

I'm using SQLite 3 and I'm trying to write a query that takes a bunch of long strings of text, and counts the number of words in each one.

我也想忽略html标签(或插入符号之间的任何东西),例如段落标签,断开标签,等等。

I also want to ignore html tags (or anything between carets) such as paragraph tags, break tags, etc.

所以当我运行查询从相应的列中选择文本,我得到一个大的冗长的文本输出与一些html标签,我只想要

So when I run a query selecting text from the appropriate column, I get a large wordy text output with some html tags in it, and I just want to count the words.

如何写一个查询来做这个?

How can I write a query to do this?

推荐答案

据我所知,没有办法直接计算SQL lite 3中字符串中的字数。(我更熟悉mysql和ms sql)

As far as I know there is no way to directly count the number of words in a string in SQL lite 3. (I'm more familiar with mysql and ms sql)

您可以使用长度和替换作为工作

You can use Length and Replace as a work around

SELECT length(@String) - length(replace(@String, ' ', '')) + 1

更多推荐

查询计数字SQLite 3

本文发布于:2023-11-22 05:51:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616206.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数字   SQLite

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!