数据库架构困境
我正在开发食谱数据库的数据库方案。 您对如何增强我现有的模型有一些想法吗?我最关心的是 RECIPE_INGREDIENT 表。
I am developing database scheme for recipes database.
Do you have some ideas how to enchance my existing model? My bigges concern is RECIPE_INGREDIENT table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 RECIPE_INGREDIENT 中,您可以安全地删除 RECIPE_INGREDIENT_ID 并将其替换为 (INGREDIENT_ID, RECIPE_ID) 作为组合主键,类似于 Recipe_tags 表。除非您打算允许某种成分在食谱中出现两次。
否则这个设计对我来说看起来不错。你想改进什么?如果您解释一下您尝试使用数据库完成什么任务以及您计划运行哪些查询,这可能会有所帮助。
In RECIPE_INGREDIENT you can safely remove the RECIPE_INGREDIENT_ID and replace it with (INGREDIENT_ID, RECIPE_ID) as combined primary key, similiar to the recipe_tags table. That is unless you plan to allow an ingredient to appear twice in a recipe.
Otherwise the design looks fine to me. What do you want to improve? It might help if you explain what you're trying to accomplish with the database and which queries you plan to run.
我真的看不出你想增强什么。我对数据库没有太多经验,但这似乎已经正确标准化。我唯一想知道的是将 INGREDIENT_DESC 包含在 RECIPE_INGREDIENT 中,而不是将其与成分本身一起保留在 RM_INGREDIENT 中。
I can't really see what you're trying to enhance. I don't have a lot of experience with databases, but this seems to be normalized correctly. The only thing I wonder about is the inclusion of INGREDIENT_DESC in RECIPE_INGREDIENT instead of keeping it with the ingredient itself in RM_INGREDIENT.
一般来说,你会有某种过程或步骤,一个食谱有很多,其中有很多成分。
食谱 1 - 许多食谱步骤
食谱步骤 1 - 许多食谱成分
Generally you would have some sort of process or step that a recipe has many of which has many ingredients.
Recipe 1 - Many Recipe Step
Recipe Step 1 - Many Recipe Ingredients