ON DELETE, ON UPDATE 事件触发限制,可选参数: RESTRICT | CASCADE | SET NULL | NO ACTION
-
RESTRICT(限制外表中的外键改动)
-
CASCADE(跟随外键改动)
-
SET NULL(设空值)
-
SET DEFAULT(设默认值)
-
NO ACTION(无动作,默认的)
CREATE TABLE `bank_account_group_has_bank_account` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `bank_account_group_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', `bank_account_id` INT(10) UNSIGNED NOT NULL DEFAULT '0', PRIMARY KEY (`id`), INDEX `FK_bank_account_group_has_bank_account_bank_account` (`bank_account_id`), INDEX `FK_bank_account_group_has_bank_account_bank_account_group` (`bank_account_group_id`), CONSTRAINT `FK_bank_account_group_has_bank_account_bank_account` FOREIGN KEY (`bank_account_id`) REFERENCES `bank_account` (`id`), CONSTRAINT `FK_bank_account_group_has_bank_account_bank_account_group` FOREIGN KEY (`bank_account_group_id`) REFERENCES `bank_account_group` (`id`) ) COMMENT='bank_account_group 与 bank_account 的 N:M 关系' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=35;
原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。