如何检查字符串是否包含子字符串?

时间:2020-10-25 04:14:55

标签: postgresql

我有一个表,其字段名称为out,类型为text

我想获取包含子字符串“ hello and good morning”的行

我试图写:

select *
from my_table
where out like 'hello and good morning%'

但它似乎不起作用。

如何获取包含子字符串的所有行?

1 个答案:

答案 0 :(得分:1)

根据给定的细节,这应该可行。

select * from my_table where LOWER(out) like LOWER('%hello and good morning%')

这里是fiddle