How to execute case insensitive query in MySQL


Most of you came across this problem when executing query. Creating tables in proper case and access the same tables in lowercase.This should return error in some OS environment.I will explain below.

create table ProductDetails(ProductName varchar(50), Version varchar(10));

select * from productdetails;

The above query will work fine when execute in mysql in windows environment. But the same is failed to process in linux environment mysql. Because most linux operating systems are case sensitive so based on that database or table names are case sensitive.

To solve this problem. Use the –lower_case_table_names parameter to start the  mysql dameon. This parameter will ensure that the mysql will process the database or table names in case insensitive.

select * from productdetails;

select * from ProductDetails;

After setting the above param. The above two queries will work fine.

Advertisements

Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: