I tried a couple of solutions and the regex was the slowest.
The quickest solution is to compare the first character with whitelist characters using the IN (...) clause:
SELECT * FROM category_data WHERE LEFT(category, 1) NOT IN( 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' );
The second quickest solution is to use the INSTR function to check the first character against the whitelist:
SELECT * FROM category_data WHERE INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789', LEFT(category, 1)) = 0;
Salman a
source share