- A+
1、查询小写字母相关数据
SELECT * FROM address WHERE district LIKE '%m%'
2、查询大写字母相关数据
SELECT * FROM address WHERE district LIKE '%M%'
问题:通过上面两条SQL语句,发现MySQL的like查询时不区分大小写的
解决方法(查询时指定区分大小写):在like后面加个binary
就OK了,或者在查询字段前面加binary
SELECT * FROM address WHERE district LIKE BINARY '%m%'
SELECT * FROM address WHERE district LIKE BINARY '%M%'
您可以选择一种方式赞助本站
赏