SQL 如果文本中包含特定文本,则 SQLite 选择字段
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8770188/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQLite select field if text inside contains a specific text
提问by Levi Botelho
I want to select field if the text inside contains a specific word in addition to the entire text, for example:
如果里面的文本除了整个文本之外还包含一个特定的单词,我想选择字段,例如:
field value = Hello, World!
字段值 = Hello, World!
I want to select this field according to the text Hel
我想根据文字选择这个字段 Hel
Thanks!
谢谢!
回答by Levi Botelho
SELECT *
FROM table
WHERE field LIKE "Hel%"
You could also do LIKE "%Hel%" which would select a field containing the string "Hel" anywhere within it as opposed to "Hel%" which requires that the string starts with "Hel"
您也可以执行 LIKE "%Hel%" 选择一个包含字符串 "Hel" 的字段,而不是 "Hel%",后者要求字符串以 "Hel" 开头