create table student(
id int(8) UNSIGNED NOT NULL AUTO_INCREMENT,
name varchar(64),
cid int(8) not null,
CONSTRAINT FK_stu_class FOREIGN KEY(cid) REFERENCES class(id) ON UPDATE CASCADE ON DELETE CASCADE
)
表class的id发生修改,则student的cid也相应发生修改;如果删除class中的id记录,则student中的相应cid记录也被删除