mysql Like查询默认是不区分大小写的:
如:
select * from table t where t.colum1 like concat('%','a','%');
select * from table t where t.colum1 like concat('%','A','%');两个sql查询结果相同;
如果必要区分的话可以这样:
select * from table t where binary t.colum1 like concat('%','A','%');
建表时,字段加上标识也可以区分大小写:
create table t{
code varchar(10) binary
}
本文介绍了MySQL中如何实现大小写敏感的LIKE查询。通常情况下,MySQL的LIKE查询默认不区分大小写,但可以通过使用BINARY关键字或者在创建表时指定字段为BINARY来改变这一行为。

1557

被折叠的 条评论
为什么被折叠?



