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

数据库   发布日期:2025年06月13日   浏览次数:228

——添加外键约束

语法:
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);

以上就是Oracle:SQL语句--对表的操作——添加外键约束的详细内容,更多关于Oracle:SQL语句--对表的操作——添加外键约束的资料请关注九品源码其它相关文章!