I have to query a database where I have a table of people's data (name, address, neighborhood, age, city, etc.) I want to obtain the addresses that necessarily have numbers, since I have some addresses where only the street name but no number.
I have tried with:
... WHERE direccion LIKE '% [0-9]'
but I don't get results.
This should work, using a regular expression that matches one or more times a digit in the evaluated value:
To get the inverse result (values without digits), simply add NOT before the condition:
You can use a REGEX , like this:
this will get the fields that only contain numeric values.
update: the requirement is that the fields that contain numeric values are required but can contain characters, so we remove the exclusivity, and we have.
Try using REGEXP or RLIKE Look here