码迷,mamicode.com
首页 > 其他好文 > 详细

binary在select中用来区分大小写

时间:2017-08-07 13:44:43      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:binary

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)


binary在select中用来区分大小写

标签:binary

原文地址:http://12173069.blog.51cto.com/12163069/1954111

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!