mysql数据库查询语句解决办法

WBOY
Release: 2016-06-13 13:51:51
Original
871 people have browsed it

mysql数据库查询语句
binary   A.username   LIKE   '%$keyword% ',请问这与不用binary的语句A.username   LIKE   '%$keyword% '有什么区别??
那个更好啊,请大侠帮我解释下

------解决方案--------------------
binary区分大小写
------解决方案--------------------
1、区分大小写
2、这样可以对中文进行LIKE操作。
------解决方案--------------------
like binary 更好 可以更精确的匹配 如果这个$kword 你赋个值 让他等于‘a’你就看到区别了
------解决方案--------------------

不仅是大小写的问题,
对一些collation, 有些字符或组合有特别含义,
如latin1_german2_ci中, Ä = AE
就是说你 where x like 'AE% ' 会把 'Äxxx ' 也找出来

用了binary就完全按照字符二进制值查找了,相当于没有字符集

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!