Whether mysql set the field can be null

 

// does not permit null 
ALTER Change Table table1 ID ID int ( 10 Not) null ;
 // allowed to be null 
ALTER Change Table table1 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

 

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11300506.html