0
点赞
收藏
分享

微信扫一扫

非空约束

楚木巽 2023-05-27 阅读 56

1、非空约束,针对某个字段设置其值不为空,如:学生的姓名不能为空

drop table if exists t_student;

create table t_student(

student_id   int(10),

student_name varchar(20) not null,

sex char(2)  default  'm',

birthday date,

email varchar(30),

classes_id int(3)

)

非空约束_字段

2、加入的学生姓名为空,插入失败

insert into t_student (student_id,birthday,email,classes_id) values(1002,'1998-12-12','123456@qq.com',15);

非空约束_字段_02


举报

相关推荐

0 条评论