Skip to content
Advertisement

Filtering records not containing numbers

I have a table that has numbers in string format. Ideally the table should contain 10 digit number in string format, but it has many junk values. I wanted to filter out the records that are not ideal in nature.

Below is the sample table that I have:

Expected Output:

Basically I want all the records that dont have 10 digit numbers in them.

I have tried out below query:

But this does not returns any records.

Have created a fiddle for the same.

P.S. The columns length and ##Comment are illustrative in nature.

Advertisement

Answer

You want RLIKE not LIKE:

Note that % is a LIKE wildcard, not a regular expression wildcard. Also, regular expressions match the pattern anywhere it occurs, so no wildcards are needed for the beginning and end of the string.

If you want to find values that are not ten digits, then be explicit:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement