liv a
liv a

Reputation: 3350

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

Upvotes: 13

Views: 22617

Answers (1)

user330315
user330315

Reputation:

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

Upvotes: 20

Related Questions