How to check if the field contains any alphabetic letters in Postgresql?
I have a text field on my Postgresql database that I want to store only numeric characters and special characters, like '-' and '.', and I have to delete all the rows that contains alphabetic letters from the database. How can I do this, i.e, find all the rows that contains alfabetic letters on a specified field?
Solution 1:
Using PostgreSQL Regex. That code must solve your problem.
select * from your_table where (column_text ~* '[a-z]') is false
~*
matches a regular expression with case insensitive, and [a-z]
represent all letters from a to z.