Good database design, variable number of attributes

后端 未结 4 1982
借酒劲吻你
借酒劲吻你 2021-02-04 10:16

I\'m trying to create a database that contains a list of equipment. All of the equipment will have certain common attributes (such as manufacturer, model #, serial #, etc.), the

4条回答
  •  礼貌的吻别
    2021-02-04 10:57

    Alternatives 1, 2, and 3 are outlined by Martin Fowler in one of his books, and on his website.

    Single Table Inheritance (option 1)

    Concrete Table Inheritance (option 2, sort of)

    Class Table inheritance (option 3)

    My preference is option 3. Each one has its place in the general scheme of things.

    EAV accomodates adding new attributes on the fly very well. But when it comes time to turn the data into useful information, an EAV database can be a nightmare.

    I have a longer answer, which I will post on demand.

提交回复
热议问题