首页 > 数据库 > SQL Server > 正文

SQL语句查询是否为空 =null及null

2024-08-31 00:46:49
字体:
来源:转载
供稿:网友
   a                  b                             c             d
980515      精企有限公司         家豪      NULL
980514      全欣木有限公司         NULL       123
980514      迅科技股份有限公司   逢浚      NULL
980515      越企有限公司   NULL       111 

表结构如上所示,要查询C列为空的记录的SQL语句不是select * from table where c=null; 或者 select * from table where c=’’; 而应当是 select * from table where c is null; 相反地要查询不为空的则应当是 select * from talbe where c<>’’; 或者 select * from table where c is not null; 注意:不是not is null哦。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表