oracle多个约束出现应该怎么做

img


在课本上碰到的题,像这种题应该怎么做,刚开始学,不太懂怎么弄多个约束

建表的时候就可以设置not null不为空啊,然后约束可以等建表完成之后再一个一个加
alter table test add constraint test_key primary key (id) 这种语句去加

reate table sc(student_no varchar2(20),
course_no varchar2(20),
score number(5,1) check (score>=0 and score<=100),
primary key(student_no,course_no),
constraint fk_1 foreign key(student_no) reference 学生表(student_no),
constraint fk_2 foreign key(course_no) reference 课程表(course_no)
)

这些约束可以建表的时候直接添加,主键直接就是唯一且非空的了
我也是学生,仅供参考哈,应该没错