liv a liv a - 3 months ago 12
SQL Question

SQL Query Where Field DOES NOT Contain numeric value

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. How can I do this?

Answer

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

Comments