sql字符串查找大小写敏感相关

select * from table   where target_text like "3";

等价于

select * from table   where target_text = "3";

查找出来的都是target_text  为 3 的数据

select * from table   where target_text like "%3%";

查找出来的都是target_text  包含 3 的数据

数据库本身大小写需要在建表的时候指定某个字段的大小写是否敏感,如果要强制下:

create  table  table_name(    
     name varchar (20) binary      
);  

如果建表的时候忘记了大小写敏感,mysql可以怎么写:

select * from table_a where source_text =  BINARY 'booK';

相应的ibats可以这么写

<isNotEmpty property="sourceText" prepend="AND">
source_text = BINARY #sourceText#
</isNotEmpty>

原文地址:https://www.cnblogs.com/huhuuu/p/4950304.html