首页 > 数据库技术 > 详细

mysql操作-外键

时间:2018-07-13 17:27:38      阅读:130      评论:0      收藏:0      [点我收藏+]
1.创建外键,关联两个表

create table score(
    id int not null auto_increment,
    subject char(32) not null,
    stu_id int not null,
    primary key(id),
    key fk_stu_key (stu_id),
    constraint fk_stu_key foreign key (stu_id) references student (stu_id));

mysql操作-外键

原文:http://blog.51cto.com/13803166/2141837

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!