LIKE '[charlist]%' syntax not working in MySQL (phpMyAdmin)
MySQL :
Case insensitive: SELECT * FROM Students WHERE StudentName RLIKE '^[npy]' ;
Case sensitive : SELECT * FROM Students WHERE StudentName CAST(RLIKE as BINARY) '^[npy]' ;
There is an even shorter way to write your query:
SELECT * FROM Students WHERE StudentName REGEXP '^[npy]'
And if you're concerned about being case sensitive:
SELECT * FROM Students WHERE StudentName REGEXP BINARY '^[npy]'
In MySQL, a REGEXP
pattern match succeeds anywhere in the value, which differs from LIKE
where the pattern must match the entire value.
The following link will give you a more complete answer:
MySQL Pattern Matching