PostgreSQL:选择包含特殊字符的文本

发布于 2025-02-01 15:28:12 字数 346 浏览 1 评论 0原文

我想选择以下字符串的选择:

Pink
Nando's
M&M's
Banana
Black & White

如您所见,有和没有特殊字符的单词组合。实际列表太长(> 3K项目),因此我想知道最通用的选择方法,因为以下选择是行不通的:

select *
from my_table
where col1 in (
'Pink',
'Nando's',
'M&M's',
'Banana',
'Black & White')

也不会使用,例如'%my string%'< /代码>

I would like to make the selection of the following strings:

Pink
Nando's
M&M's
Banana
Black & White

As you can see there's a combination of words with and without special characters. The actual list is too long (> 3k items), so I'd like to know the most generic way of making this selection as the following won't work:

select *
from my_table
where col1 in (
'Pink',
'Nando's',
'M&M's',
'Banana',
'Black & White')

nor will using LIKE '%my string%'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文