Ver originalCREATE TABLE IF NOT EXISTS `alumnos` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `nombres` varchar(100) COLLATE utf8_unicode_ci NOT NULL, `apellido` varchar(50) COLLATE utf8_unicode_ci NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; CREATE TABLE IF NOT EXISTS `B` ( `id` int(11) NOT NULL AUTO_INCREMENT, `sedes_id` int(11) NOT NULL, `alumnos_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `fk_2` (`alumnos_id`)) ENGINE=InnoDB CHARSET=utf8 COLLATE=utf8_unicode_ci ;
Ver originalALTER TABLE `B` ADD CONSTRAINT `fk_2` FOREIGN KEY (`alumnos_id`) REFERENCES `alumnos` (`id`) ON UPDATE CASCADE;