简体   繁体   English

SQL查询字段不包含数字

[英]SQL Query Where Field DOES NOT Contain a Digit

I have a table with an address street, I want to make sure the address contains the street as well as house/building number (saxon 17) I want to write an SQL query to find rows where field address does not contain a numeric value. 我有一个地址街的表,我想确保地址包含街道以及房屋/建筑物编号(saxon 17)我想写一个SQL查询来查找字段地址不包含数值的行。 How can I do this? 我怎样才能做到这一点?

This can be done using a regular expression: 这可以使用正则表达式完成:

select *
from the_table
where address_column !~ '[0-9]'

More details about regular expressions and pattern matching can be found in the manual: 有关正则表达式和模式匹配的更多详细信息,请参见手册:
http://www.postgresql.org/docs/current/static/functions-matching.html http://www.postgresql.org/docs/current/static/functions-matching.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM