首页 > 其他 > 详细

binary在select中用来区分大小写

时间:2017-08-07 13:22:19      阅读:379      评论:0      收藏:0      [点我收藏+]

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中用来区分大小写

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!