Exercise: 35

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

Solution

SELECT model, type
FROM Product
WHERE model NOT LIKE '%[^0-9]%'
	OR model NOT LIKE '%[^a-zA-Z]%'

References

  1. LIKE (Transact-SQL)

  2. Wildcard characters sql only alphabet characters