Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Sql Mysql-example MySQL Case Sensitive

Related Tutorials


 
 

Share on Google+Share on Google+

MySQL Case Sensitive

Advertisement
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:

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: January 20, 2009

Related Tutorials

Discuss: MySQL Case Sensitive   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com