Select query in MySQL can be either case sensitive or case insensitive by default.
It depends on CHARSET defined while creating the table. Binary chartset(e.g utf8) will make select query case sensitive by default. But anyway we can force the select query case insensitive by using UCASE in the query.
e.g select * from companys where ucase(name)=ucase('QualityPoint')
More Articles...
Popular Posts
- Software Testing Quiz Questions and Answers
- Javascript Quiz Questions and Answers
- MySQL Quiz Questions and Answers
- SEO Your Blog the Easy Way - Guest Post
- SEO (Search Engine Optimization) Quiz Questions and Answers.
- PHP Quiz Questions and Answers
- Basic Computer Hardware Quiz Questions and Answer.
- Use of tinyurl in Twitter
- HTML Quiz Questions and Answers
- General Knowledge Quiz Questions and Answers

2 comments:
Actually, it depends on the collation of the column or expression, not the character set. Collations are related to character sets, and binary collations are case sensitive, as are columns of the (VAR)BINARY data type.
For example:
mysql> select "equals" = "EQUALS";
+---------------------+
| "equals" = "EQUALS" |
+---------------------+
| 1 |
+---------------------+
1 row in set (0.00 sec)
versus
mysql> select "equals" = "EQUALS" collate latin1_bin;
+----------------------------------------+
| "equals" = "EQUALS" collate latin1_bin |
+----------------------------------------+
| 0 |
+----------------------------------------+
1 row in set (0.35 sec)
or
mysql> select "equals" = cast("EQUALS" as BINARY);
+-------------------------------------+
| "equals" = cast("EQUALS" as BINARY) |
+-------------------------------------+
| 0 |
+-------------------------------------+
1 row in set (0.00 sec)
Justin Swanhart,
Thanks for your explanation.
Post a Comment