I have a VARCHAR column called description in the table test_table. How do I only return rows that contain a number or decimal number in the description column?
So for example these would be considered valid rows to return:
I love the number 3424434 is coolwhen can 23 be the best ageMy sweet16todaywhen there is 0.143secs leftI love 0.314 because its pi
As long as there is any number in the description, its considered a valid row to return.
I've tried:
SELECT * FROM test_table
WHERE REGEXP_LIKE(X, '^[[:digit:]] $');
CodePudding user response:
^[[:digit:]] $ will match strings with numeric characters only (no non-numeric characters). You should use '[[:digit:]] ' or [0-9].
CodePudding user response:
You can use bracket wildcards that search for only numbers.
SELECT * FROM test_table
WHERE description LIKE '%[1234567890]%';
