CREATE TABLE IF NOT EXISTS `ei_Promo2ProductCategory` ( `promoId` int(11) NOT NULL, `categoryId` int(11) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; ALTER TABLE `ei_Promo2ProductCategory` ADD PRIMARY KEY (`promoId`,`categoryId`), ADD KEY `categoryId` (`categoryId`); ALTER TABLE `ei_Promo2ProductCategory` ADD CONSTRAINT `ei_Promo2ProductCategory_ibfk_1` FOREIGN KEY (`promoId`) REFERENCES `ei_Promo` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, ADD CONSTRAINT `ei_Promo2ProductCategory_ibfk_2` FOREIGN KEY (`categoryId`) REFERENCES `prj_elements_inc`.`ei_ProductCategory`(`id`) ON DELETE RESTRICT ON UPDATE RESTRICT;