बनाने मैं इस तालिका है का प्रयास करते हैं:MySQL त्रुटि: # 1005 - तालिका (errno: 150) नहीं बना सकता मैंने 1 से अधिक FK
CREATE TABLE IF NOT EXISTS `produtos` (
`id` int(11) NOT NULL auto_increment,
`idcatprodutos` int(11) NOT NULL,
`idcategoria` int(11) NOT NULL,
`idmarca` int(11) NOT NULL,
`nome` varchar(100) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_produtos_2` (`idcatprodutos`),
KEY `FK_produtos_3` (`idmarca`),
KEY `FK_produtos_4` (`idcategoria`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=39 ;
और इस तालिका:
CREATE TABLE IF NOT EXISTS `sugestoes` (
`id` int(11) NOT NULL auto_increment,
`idproduto` int(11) NOT NULL,
`idsugestao1` int(11) NOT NULL,
`idsugestao2` int(11) NOT NULL,
`idsugestao3` int(11) NOT NULL,
`idsugestao4` int(11) NOT NULL,
PRIMARY KEY (`id`),
KEY `FK_sugestoes_prod` (`idproduto`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED AUTO_INCREMENT=9 ;
मैंने पहले से ही एक एफके sugestoes.idproduto -> produtos.id
काम किया है, लेकिन मैं चाहता हूं कि प्रत्येक अन्य फ़ील्ड नए एफके के माध्यम से produtos.id
का भी संदर्भ लें। भागो कि वापसी MySQL त्रुटि नीचे इस आदेश: # 1005 - टेबल बनाया नहीं जा सकता (errno: 150):
ALTER TABLE `infantile`.`sugestoes` ADD CONSTRAINT `FK_sugestoes_2` FOREIGN KEY `FK_sugestoes_2` (`idsugestao1`)
REFERENCES `produtos` (`id`)
ON DELETE SET NULL
ON UPDATE CASCADE
, ROW_FORMAT = FIXED;
किसी को भी किसी भी विचार क्या हो रहा है है?
आप 'वैकल्पिक तालिका' में ', ROW_FORMAT = FIXED' क्यों जोड़ते हैं? –