Mysql (级联更新、级联删除)

1.创建表


create table stu(
sid int UNSIGNED primary key auto_increment,
name varchar(20) not null)engine=InnoDB charset=utf8;

create table sc(
scid int UNSIGNED primary key auto_increment,
sid int UNSIGNED not null,
score varchar(20) default '0',
index (sid),   -- 外键必须加索引
FOREIGN KEY (sid) REFERENCES stu(sid) ON DELETE CASCADE ON UPDATE CASCADE)
engine=InnoDB charset=utf8;

2.数据库无法创建创建INNODB的数据表,【解决办法

3.操作步骤参考链接

posted @ 2019-11-01 16:04  jhai  阅读(124)  评论(0)    收藏  举报
……