MySQL select using multiple "NOT LIKE"

  • Published by steve on 28 December 2011.

Scenario

Version: MySQL 5.0
Database Name: testdb
Table Name: domains
Field Name: domainame

Example

Show all domain names that do not contain any digit from 0 to 9.
SELECT * FROM `domains` WHERE `domainame` NOT LIKE '%0%'
and `domainame` NOT LIKE '%1%'
and `domainame` NOT LIKE '%2%'
and `domainame` NOT LIKE '%3%'
and `domainame` NOT LIKE '%4%'
and `domainame` NOT LIKE '%5%'
and `domainame` NOT LIKE '%6%'
and `domainame` NOT LIKE '%7%'
and `domainame` NOT LIKE '%8%'
and `domainame` NOT LIKE '%9%'