CREATE TABLE animals (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
name CHAR(30) NOT NULL,
PRIMARY KEY (id)
);
insert into animals values(null,'kitty'),(null,'KITTY'),(null,'hello');
#没用binary
select id from animals where name like '%it%';
+----+
| id |
+----+
| 1 |
| 2 |
+----+
2 rows in set (0.00 sec)
#用到binary
select id from animals where name like binary '%it%';
+----+
| id |
+----+
| 1 |
+----+
1 row in set (0.03 sec)
本文转自 Lee_吉 51CTO博客,原文链接:http://blog.51cto.com/12173069/1954111