为了账号安全,请及时绑定邮箱和手机立即绑定

SQL Server中,null 与not null 在什么时候用?

SQL Server中,null 与not null 在什么时候用?

至尊宝的传说 2018-12-31 00:00:46
SQL Server中,null 与not null 在什么时候用?
查看完整描述

1 回答

?
明月笑刀无情

TA贡献1828条经验 获得超4个赞

sql server 中使用 null 和 not null 来判断列的空值。

语法为:
列名 is null (字段为空返回true ,不为空返回 false)
列名 is not null (字段为空返回false,不为空返回 true)

例:
select case when a is null then 1 else 0 end from aaa

语法大意:如果a列 为空显示1,不为空显示0

查看完整回答
反对 回复 2019-01-16
  • 1 回答
  • 0 关注
  • 744 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信