gpt4 book ai didi

sqlite - 如何在 sqlite 中转义 % 符号?

转载 作者:IT王子 更新时间:2023-10-29 06:25:14 26 4
gpt4 key购买 nike

我使用 LIKE 子句进行全文搜索,文本可以包含“%”。

在 sqlite 数据库中搜索 % 符号的好方法是什么?

我试过了

SELECT * FROM table WHERE text_string LIKE '%[%]%' 

但这在 sqlite 中不起作用。

最佳答案

来自SQLite documentation

If the optional ESCAPE clause is present, then the expression following the ESCAPE keyword must evaluate to a string consisting of a single character. This character may be used in the LIKE pattern to include literal percent or underscore characters. The escape character followed by a percent symbol (%), underscore (_), or a second instance of the escape character itself matches a literal percent symbol, underscore, or a single escape character, respectively.

关于sqlite - 如何在 sqlite 中转义 % 符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23318708/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com