如何使用LIKE查询在PostgreSQL中找到文字百分号(%)? [英] How can you find a literal percent sign (%) in PostgreSQL using a LIKE query?
本文介绍了如何使用LIKE查询在PostgreSQL中找到文字百分号(%)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的表中有个字符不同的
条目,其中 some (并非全部)值包含百分比,例如' 12%'
, '97%'
等。我想找到所有包含百分比的值。换句话说,我想找到所有以百分号('%'
)结尾的值。
I have character varying
entries in a table where some (not all) values contain percentages, e.g., '12%'
, '97%'
, etc. I want to find all the values that contain percentages. In other words, I want to find all values that end with a percent sign ('%'
).
推荐答案
您可以尝试以下操作:
SELECT * FROM my_table WHERE my_column LIKE '%\%%' ESCAPE '\';
格式化
<like predicate> ::=
<match value> [ NOT ] LIKE <pattern>
[ ESCAPE <escape character> ]
<match value> ::= <character value expression>
<pattern> ::= <character value expression>
<escape character> ::= <character value expression>
这篇关于如何使用LIKE查询在PostgreSQL中找到文字百分号(%)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文