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','[email protected]',15);