// name varchar
// id bigint
SELECT * FROM mybatis.t_student where name = 张三; 错误
SELECT * FROM mybatis.t_student where name = '张三'; 正确
SELECT * FROM mybatis.t_student where id = 1;正确
SELECT * FROM mybatis.t_student where id = '1';正确
为什么呢,因为 id 是 int类型,MySQL识别到 ‘1’ 时,自动转为int 1
而字符串就不可以。