我似乎无法在这里创建第三个表。这是怎么回事?我收到通用无法创建表 errno 150 消息。似乎与外键有关
餐桌食谱
CREATE TABLE recipe(
recipe_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
name VARCHAR(40) NOT NULL,
description VARCHAR(40) NOT NULL,
PRIMARY KEY (recipe_id)
)
ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_swedish_ci;
表成分类型
CREATE TABLE ingredient_type(
ingredient_type_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
ingredient_type VARCHAR(40) NOT NULL,
description VARCHAR(40) NOT NULL,
PRIMARY KEY (ingredient_type_id)
)
ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_swedish_ci;
餐桌配料
CREATE TABLE ingredient(
ingredient_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
ingredient_type_id INT(10) NOT NULL,
name VARCHAR(40) NOT NULL,
brand_name VARCHAR(40) NOT NULL,
FOREIGN KEY (ingredient_type_id) REFERENCES ingredient_type (ingredient_type_id),
PRIMARY KEY (ingredient_id)
)
ENGINE=INNODB CHARACTER SET utf8 COLLATE utf8_swedish_ci;