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.操作步骤参考链接

浙公网安备 33010602011771号