Reputation: 7515
I need to select rows that contains a whole word, NOT a substring. For example from these rows:
I need to get only first one (that contains word good), but with my sql query I get both of them.
select *
from my_tab
where my_column like '%good%'
Please note, I need this in sqlite, where not all usual sql functions are available.
Upvotes: 0
Views: 1376
Reputation: 15538
You can also use regular expressions (see https://antonz.org/sqlean-regexp/) to add additional parsing to the beginning and end of the substring your searching for, although it will add complexity and does require adding a module to the SQLite engine. One potential repository that includes the regular expression function is https://github.com/nalgeon/sqlean
Upvotes: 0
Reputation: 11556
You can check it like a space between both %
symbols and a and
%
int end of the word and a %
and to the beginning of the word which you need to search.
Query
select * from your_table_name
where words like '% good %'
or words like 'good %'
or words like '% good';
Upvotes: 5