mysql - 在MYSQL select查询中,我们是否只需要传递 'INT'类型数据的int值?

标签 mysql

实际上“状态”列中不存在以下值(即 1ooo,1ee)”,但结果正在发送。状态列仅包含一 strip 有 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 执行的隐式 convdrsione ..并且在每种情况下第一个字符(或字符集)都是有效数字

'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/

相关文章:

mysql 在使用 group by 和 where 条件时忽略 NULL

php - 从 SQL 数据库检索列表并为 AS3 中的每一行创建链接

php - 将输入的数据从 html 表单添加到 mysql 数据库,简单

MySql:索引表的所有字段以加速搜索查询

mysql - 加载数据本地内文件修剪 £

mysql - PHP 代码中的 SQL 语法错误 - 将两个值相加

mysql - 如何按数字和字母顺序对数据进行排序取决于mysql中单个查询的条件

mysql - Rails 数组参数未传递到数据库

mysql - 多个 if 语句丢失数据

mysql - Rails数据库结构及优化建议