详解Mysql查询条件中字符串尾部有空格也能匹配上的问题

数据库 发布日期:2024/9/23 浏览次数:1

正在浏览:详解Mysql查询条件中字符串尾部有空格也能匹配上的问题

一、表结构

TABLE person

id name 1 你 2 你(一个空格) 3 你(二个空格)

二、查询与结果

select * from person where `name` = "htmlcode">
select * from person where `name` like "htmlcode">
select * from person where `name` = BINARY ?

BINARY 不是函数,是类型转换运算符,它用来强制它后面的字符串为一个二进制字符串,可以理解成精确匹配

以上就是本次介绍的全部相关知识点,如果大家有任何补充可以联系小编。