MySQL - Supertype/Subtype design

前端 未结 2 2088
被撕碎了的回忆
被撕碎了的回忆 2020-12-05 12:52

I need to create the following database:

\"enter

For semi-trucks I don\'t need

2条回答
  •  抹茶落季
    2020-12-05 12:59

    I refer you to the "Info" tab under the following three tags:

    class-table-inheritance single-table-inheritance shared-primary-key

    The first two describe the two major design patterns for dealing with a class/subclass (aka type/subtype) situation when designing a relational database. The third descibes a technique for using a single primary key that gets assigned in the superclass table and gets propagated to the subclass tables.

    They don't completely answer the questions you raise, but they shed some light on the whole topic. This topic, of mimicking inheritance in SQL, comes up over and over again in both SO and the DBA area.

提交回复
热议问题