SQLite 选择包含整个单词的行

Cho*_*ski 0 sql sqlite

我需要选择包含整个单词的行,而不是子字符串。例如从这些行:

  • 系统运行良好
  • 我有一些好东西

我只需要得到第一个(包含单词good),但是通过我的 sql 查询,我得到了两个。

select *
from my_tab
where my_column like '%good%'
Run Code Online (Sandbox Code Playgroud)

请注意,我需要在 sqlite 中使用它,其中并非所有常用的 sql 函数都可用。

Ull*_*las 5

您可以在%符号和单词的a%int 结尾以及 a%您需要搜索的单词的开头之间检查它。

询问

select * from your_table_name
where words like '% good %'
or words like 'good %'
or words like '% good';
Run Code Online (Sandbox Code Playgroud)