Database design for Tagging multiple types of entities

后端 未结 6 1982
抹茶落季
抹茶落季 2021-02-02 04:19

I\'m currently designing a database schema that\'s used to store recipes. In this database there are different types of entities that I want to be able to tag (ingredients, reci

6条回答
  •  北荒
    北荒 (楼主)
    2021-02-02 04:58

    I think you're on the right track. You have described it really good, you have a couple of different entities. You could create a table called entities witch contains all the common attributes (if there is any). So for example

    Entity

    • EntityId
    • Name

    Ingredient

    • EntityId
    • Amount

    RecipeIssuer

    • EntityId
    • SomeOtherInformation

    Now you can have a table to tag entities.

提交回复
热议问题