MENU

null 的用法

June 6, 2018 • Read: 3441 • 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