Here we are going to read about the MySQL case sensitivity. The case sensitive is a term that tells you to check lettercase either upper case or lower case. In Windows, database and table names, table aliases are not case sensitive. Operating system also affects the case sensitivity of database and table names. For example, Table names, table aliases are case sensitive in Unix operating system. Column, column aliases, index, and stored routine names are not case sensitive on any platform.
|CREATE TABLE `employee` (
`emp_id` int(11) NOT NULL auto_increment,
`emp_name` varchar(100) character set utf8 NOT NULL,
`emp_salary` int(11) NOT NULL,
`emp_startDate` datetime NOT NULL,
`dep_name` varchar(50) NOT NULL,
PRIMARY KEY (`emp_id`)
|SELECT * FROM employee;|
|SELECT * FROM EMPLOYEE;|
are same statements in widows.
But employee and EMPLOYEE are treated two different tables in Unix.
If you use the following query then you get result data that starts from 'a' or 'A' character.
|SELECT * FROM employee WHERE emp_name LIKE 'A%';|
If you want to get case sensitive value then you should use following queries:
|SELECT * FROM employee WHERE BINARY emp_name LIKE 'A%';|
|SELECT * FROM employee WHERE BINARY emp_name LIKE 'a%';|
Posted on: January 20, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles