SQL query where the field does not contain a digit

I have a table with the address street, I want to make sure that the address contains the street, as well as the number of the house / building (Saxon 17) I want to write an SQL query to search for rows where the address of the field does not contain a numerical value. How can i do this?

+8
source share
1 answer

This can be done using a regex:

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

More information on regular expressions and pattern matching can be found in the manual:
http://www.postgresql.org/docs/current/static/functions-matching.html

+13
source

Source: https://habr.com/ru/post/1205012/


All Articles