Dre*_*rew 10
这和关系数据库一样简单......
Table One - Ingredients
[ID] [Name] [Description?]
1 butter delicious cow output
2 bread wholegrain please
Table Two - Recipe Basic Data
[ID] [RecipeTitle] [RecipeAuthor] [RecipeSteps] (maybe as BLOB text?)
1 Happy Toast Andrew butter on bread, then toast bread, etc.
Table Three - Recipe Needs (many-to-many)
[RecipeID] [IngredientID]
1 1 (toast needs butter)
1 2 (toast needs bread)
Run Code Online (Sandbox Code Playgroud)
这应该让你开始.
编辑 - 示例查询
"所有使用黄油的食谱"
SELECT r.name FROM recipeNeeds n
LEFT JOIN tableRecipes r
ON r.ID=n.recipeID
LEFT JOIN tableIngredients i
ON i.ID=n.ingredientID
WHERE i.name='butter'
Run Code Online (Sandbox Code Playgroud)