04pallav
9/13/2017 - 9:52 PM

checking for digits and alphabets

checking for digits and alphabets

The [^0-9] expression is used to find any character that is NOT a digit.
Use the [0-9] expression to find any character between the brackets that is a digit.

Find models in the Product table consisting either of digits only or Latin letters (A-Z, case insensitive) only.


Q.35 SQL RU
SELECT * FROM Product
WHERE model NOT LIKE '%[^A-Z]%' 
OR model NOT LIKE '%[^0-9]%'


FIND only digits '%[^A-Z]%' 

like '%[0-9]%' find any numbers
like '%[A-Z]%  find any alphabets