//不允许为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

 

 

相关文章: