create table user(
id int not null auto_increment,
name varchar(30) not null,
primary key (id)
);
insert into user() values();name 没有设值居然也插入成功,不明白。
怎么使not null起到约束作用?
id int not null auto_increment,
name varchar(30) not null,
primary key (id)
);
insert into user() values();name 没有设值居然也插入成功,不明白。
怎么使not null起到约束作用?
所有要想让你的NOT NUL 起作用的话
alter table user key (`name`);
是否是空字符串select *,
ifnull(dd,1),
if(isnull(dd),1,2)
from tn1
看看结果,不是NULL,
是空字符串
只要你用NOT NULL。