给已经建好的表添加外键
> alter table 建好的表名 add constraint 外键名(不能与之前起过的名字相同) foreign key(当前表对应的字段) references 连接的主表名(主表中的主键名);
Exp:
> alter table chinese add constraint chinese_fk foreign key(No) references students(No);
给已经建好的表添加外键
> alter table 建好的表名 add constraint 外键名(不能与之前起过的名字相同) foreign key(当前表对应的字段) references 连接的主表名(主表中的主键名);
Exp:
> alter table chinese add constraint chinese_fk foreign key(No) references students(No);