PostgreSQL:获取所有包含大写字母的行

问题描述

如何执行以下stmt:

select * from table
where column has any uppercase letters; <-- how to write this

解决方法

您可以使用正则表达式进行过滤:

select * 
from mytable
where mycolumn ~ [A-Z]

另一种方法是字符串比较:

select * 
from mytable
where lower(mycolumn) <> mycolumn