select * from table1 where field1 = ‘test’
select * from table1 where field1 = ‘TEST’
如果 table1 .field1 是用_ci的整理方式( 比如utf8_general_ci ),那么上面两句效果是一样的。
换成 utf8_bin 的整理方式就OK了.
一种方法是可以设置表或行的collation(在phpmyadmin里面翻译过来是整理),使其为binary或case sensitive。在MySQL中,对于Column Collate其约定的命名方法如下:
*_bin: 表示的是binary case sensitive collation,也就是说是区分大小写的
*_cs: case sensitive collation,区分大小写
*_ci: case insensitive collation,不区分大小写