MySQL里面值为NULL的判断

select t.args1,t.args2,t.args3 from beyond t ;


 

 

select  t.args1,t.args2,t.args3 from beyond t where t.args2 != null ;

select  t.args1,t.args2,t.args3 from beyond t where t.args2 = null ;

 

这两种情况竟然查出来是 Null ,没有报错!

select  t.args1,t.args2,t.args3 from beyond t where t.args2 != 'null' 


 

注: 不仅把NUll值排除掉了,还把 值为“null"的排除掉了,用 mysql 的 null 做判断的时候,需谨慎!

猜你喜欢

转载自bugyun.iteye.com/blog/2221505