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;