hy guys...
i need some help, what i need to know is if its possible, for exemple you got 100 records all with lower and upper case characters then the user inputs a information, you want to check if there is someone with that name already, but i want to check lower and uper case letters with mysql is possible ???
thanks in advance
select but distinct sensitive words
Moderator: General Moderators
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
You can use the LCASE() (or LOWER()) and UCASE() (or UPPER()) functions. Information can be found in the MySQL manual on String Functions.
If the names have mixed case AbCdE, then you can use a regex! If you don't want to use the regex engine, then just cast the field you are matching to BINARY, then your match will be truly case sensitive.
Example...
pif
Example...
Code: Select all
// will only match (Dart) within the field, no other combinations of (dart) will match
SELECT city FROM `usa` WHERE BINARY city LIKE '%Dart%';
// will only match (Dartmouth), no other combinations of (dartmouth), will match
SELECT city FROM `usa` WHERE BINARY city = 'Dartmouth';