回复 楼主 编程2011
创建外键约束
比如主表(Students)和两个子表(Courses,Scores)建立外键关系,关联字段有Stu_id,Cur_id
代码如下:
Alter table Scores
Add constrant Score_ibfk_1 Foreign Key(Cur_id)references Courses(Cur_id) on Delete Cascade;
Add constrant Score_ibfk_2 Foreign Key(Stu_id)references Courses(Stu_id) on Delete Cascade;