gpt4 book ai didi

postgresql - 在文本 Postgres 中找到 "'"

转载 作者:行者123 更新时间:2023-11-29 14:17:08 25 4
gpt4 key购买 nike

我想使用 LIKE 选项查找 varchar 是否包含 '

我觉得是这样的

select * 
from table
where field like '%'%'

但有点不同。

最佳答案

关于转义单引号的回答:

您可以使用美元符号引号:

select * from table where field like $thing$%'%$thing$;

或在引号前使用 E:

select * from table where field like e'%\'%'

或者两个单引号:

select * from table where field like '%''%'

https://www.postgresql.org/docs/current/static/sql-syntax-lexical.html

关于postgresql - 在文本 Postgres 中找到 "'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44198805/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com