create table studentkd
(
id int primary key,
name varchar(20) not null, --姓名非空 必须填
age int
);
insert into studentkd(id,name,age)
values(1,'张三',18)
--违规插入 触发not null
-- 错误:姓名没给值,违反非空约束
INSERT INTO studentkd(id, age)
VALUES (2, 19);
--改成非空 取消非空约束
alter table studentkd
alter column name varchar(20) null;
