SQL查询为空的字段的写法is null 而不是=null

来源:互联网 发布:死亡空间游戏知乎 编辑:程序博客网 时间:2024/05/16 07:44

1 sql 查询某字段id为空

  

    select *  from  表名 where  id  is   null  ;

 

2 sql 查询某字段id不为空

 

    select * from   表名  where id  is  not  null;

 

或 select * from   表名  where id  <> null;     //

    select * from   表名  where   len(id) >1;    // (最后两个PL/SQL下验证不正确!)

 

 由于null 为一种状态,不是一个值,故建议不适用算术逻辑符号“<>” !

0 0