实际上,“status”列中没有以下值(即1oo、1e e),但结果是comming。状态列只包含一条带有1的记录。
QRY-1:select * from User_Table where key ='xxxxxxxxxxxxxxxxxxxxxxxxx' and status=1;
QRY-2:select * from User_Table where key ='xxxxxxxxxxxxxxxxxxxxxxxxx' and status="1";
QRY-3:select * from User_Table where key ='xxxxxxxxxxxxxxxxxxxxxxxxx' and status="1ooo";
QRY-4:select * from User_Table where key ='xxxxxxxxxxxxxxxxxxxxxxxxx' and status="1ee";
QRY-1:好的
对于上面的QRY-2,QRY-3,QRY-4我也得到了相同的结果?为什么?
最佳答案
发生这种情况是因为SQL执行的隐式转换。。在每种情况下,firts char(或一组char)都是有效的数字
'1' , '1ooooì, '1ee' became 1 for implict conversion to destination type
所有的问题都变成
select * from User_Table where key ='xxxxxxxxxxxxxxxxxxxxxxxxx' and status=1
关于mysql - 我们是否只需要在MYSQL select查询中传递“INT”类型数据的int值?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56358946/