not null 非空约束

例子:
create table tb1(
     id int,
     name varchar(20) not null
);

注意  空字符不等于null


#手动,添加非空约束
(必须这个字段,没有NULL值)
mysql> alter table tb1
    -> modify id int not null;

# 取消非空约束
mysql> alter table tb1
    -> modify id int ;

猜你喜欢

转载自www.cnblogs.com/mariobear/p/9180012.html