
可以的,有显式和隐式两种插入空值
方式(前提是该
字段未设置默认值且允许为空)。例如 t1(id auto_increment primary key,sname varchar(10) not null, address varchar(100))-- 显式方式向地址字段插入空值insert into t1 (sname,address) valuse('John',null)-- 隐式方式向地址字段插入空值insert into t1 (sname) valuse('John')如果state的数据
类型是 int 等数子类型或者bit类型:update 表 set state=新数字 where state is null如果state是字符串类型:update 表 set satet='新数据' where state is null or state=''1)写入时使用NULL
insert into xxx values (NULL,NULL,NULL)
2)读取时使用empty()
if(empty(row["col3"])){
//do something.
}
评论列表(0条)