mysql 设置字段是否可以为null

//不允许为null
alter table table1 change id id int(10) not null;
//允许为null
alter table table1 change id id int(10) null;
//name_new允许为空
insert table1(id,transactor) values(1,"world");

//transactor不允许为null
mysql> insert table1(id) values(1);
ERROR 1364 (HY000): Field 'transactor' doesn't have a default value

原文地址:https://www.cnblogs.com/sea-stream/p/11300506.html