MySQL Case Sensitive

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.

MySQL Case Sensitive

MySQL Case Sensitive

     

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.

 

 

 

 

 

Table: employee

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`) 
)

The queries

SELECT * FROM employee;

and

SELECT * FROM EMPLOYEE;

are same statements in widows.

But employee and EMPLOYEE are treated two different tables in Unix.

Case Sensitivity in data:

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%';

Output:

If you want to get case sensitive value then you should use following queries: 

SELECT * FROM employee WHERE  BINARY emp_name LIKE 'A%';

Output:

SELECT * FROM employee WHERE  BINARY emp_name LIKE 'a%';

Output: