Home Sql Mysql-example MySQL Case Sensitive



MySQL Case Sensitive
Posted on: January 20, 2009 at 12:00 AM
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

     

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:

Related Tags for MySQL Case Sensitive:
sqlmysqlcvireadcasecheckcastoeitlspeinrmasmoutcaletletteradasercppwerstermatmykishallivgoeaarttssthabhateithero


More Tutorials from this section

Ask Questions?    Discuss: MySQL Case Sensitive   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.