MYSQL LIKE 区分大小写匹配

时间:2022-11-14 00:50:23

原文 MYSQL LIKE 区分大小写匹配

MYSQL使用LIKE匹配时默认是不区分大小写的.
例:
select * from table_name where a like 'wss%'
select * from table_name where a like 'WSS%'
匹配的结果是一致的.


区分大小写匹配: 
select * from table_name where binary a like 'wss%' 
select * from table_name where binary a like 'wss%' 
这样就行区分大小写匹配


或者我们在建立字段时设置大小标识 
create table table_name( wss varchar (20) binary )