MENU

null的用法

June 6, 2018 • Read: 2877 • SQL阅读设置

null【没有值,空值】
  1. 零和null是不一样的,null表示空值,没有值,零表示一个确定的值
  2. null不能参与如下运算:<>,!=,=
  3. null可以参与如下运算:is,is not
select * from emp where comm is null--输出奖金为空的员工信息
select * from emp where comm is not null--输出奖金不为空的员工信息
select * from emp where comm <> null--输出奖金为空的员工信息--error 输出为空
select * from emp where comm != null--输出奖金为空的员工信息--error 输出为空
  1. 任何类型的数据都允许为null
  2. 任何数值与null参与数学运算的结果都是null
Last Modified: August 27, 2018
Archives Tip
QR Code for this page
Tipping QR Code