Mysql 无法使用where选择select语句中的列,where包含空值
以下是我的问题Mysql 无法使用where选择select语句中的列,where包含空值,mysql,Mysql,以下是我的问题 我使用createtabletimepass(anyvalue-bigint(19),name-varchar(20))创建了一个表 我在其中插入了一些空值 现在桌子看起来像这样 "anyvalue" "name" Null Rahul 12 Satish Null shubhanshu 现在当我提出这个问题时 select * from timepass where name ='Rahul' and anyvalue=Null ;
createtabletimepass(anyvalue-bigint(19),name-varchar(20))创建了一个表代码>
我在其中插入了一些空值
"anyvalue" "name"
Null Rahul
12 Satish
Null shubhanshu
现在当我提出这个问题时
select * from timepass where name ='Rahul' and anyvalue=Null ;
select * from timepass where anyvalue='Null';
或者当我发出询问时
select * from timepass where name ='Rahul' and anyvalue=Null ;
select * from timepass where anyvalue='Null';
我没有得到任何结果。
我不明白为什么会发生这种情况请解释一下试试这个
select * from timepass where anyvalue is null;
对另一个尝试同样的方法
select * from timepass where name ='Rahul' and anyvalue is null
请参阅以了解“=NULL”和“IS NULL”之间的区别。NULL是无值的。不检查列的值是否等于no value。而是检查列
是否为空
或是否为非空