62,612
社区成员
发帖
与我相关
我的任务
分享
reate table studcourse(
stucourseid int primary key auto_increment,
sid int references student(sid),
cid int references course(cid),
grade int(3) not null,
CONSTRAINT FOREIGN KEY (`sid`) references `student`(`sid`),
CONSTRAINT FOREIGN KEY (`cid`) references `course`(`cid`)
)engine=innoDB;
执行这上面的sql之前要保证student 和course这两个表也是innoDB才行,至于怎么修改数据库引擎可以在网上找。
create table t5 (c1 int ,c2 int, CONSTRAINT FOREIGN key (`c2`) references `t3`(`c1`))engine=innoDB