Oracle:SQL语句--对表的操作——添加外键约束

——添加外键约束

语法:
alter table 表1-表名
add constraint 外键名称(一般外键名称为”fK_”开头) foreign key (要设为外键的列名)
references 表2-表名(与哪个表有关联) (表2中该列列名);

alter table T_Result
add constraint fk_studentId2 foreign key (studentId)
references T_Student (studentId);

alter table t_CardInfo
add constraint fk_customerID foreign key(customerid)
references T_UserInfo (customerid);

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章