select * from A where name regexp 'ABC'
预期效果:查出名字为大写ABC的数据
实际:没有区分大小写
解决:用binary方法并改成like匹配
select * from A where binary name like 'ABC'
本文介绍了一种在SQL查询中实现大小写敏感匹配的方法。通过使用binary关键字结合like操作符,可以精确匹配指定大小写的字符串,解决了常规正则表达式不区分大小写的问题。
select * from A where name regexp 'ABC'
预期效果:查出名字为大写ABC的数据
实际:没有区分大小写
select * from A where binary name like 'ABC'

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