小白的我昨天才意识到mysql默认不区分大小写,最近刚入职实习的时候遇到了需要区分大小写的查询问题,最后解决方式是用binary!
比如,原本不区分大小写时:
select * from student where student_name in ("MfdasifhdD",“Apple”)
这样子,有可能结果会返回student_name 为 MfdasifhdD,mfdasifhdd,Apple,apple的数据
如果要对大小写敏感的话:
select * from student where binary student_name in ("MfdasifhdD",“Apple”)
这样子返回的结果只有student_name 为 MfdasifhdD,Apple