Table relationship for subtypes

后端 未结 3 1152
遥遥无期
遥遥无期 2020-12-12 03:37

I have a parent table called \'Website\' which holds records about websites. I have a child table called \'SupportSystem\' which holds records about different types of suppo

相关标签:
3条回答
  • 2020-12-12 03:50

    You could use super-type/subtype relationship, as shown in the diagram.

    • SupportSystem table contains columns common to all support systems.
    • Email, Ticketing, Phone and LiveChat tables have columns specific to each one.
    • Primary key in the subtype table is also a foreign key to the super-type table.

    0 讨论(0)
  • 2020-12-12 04:00

    Data about a Support Platform should be stored in the SupportPlatform table.

    You can add a third foreign key, namely SupportPlatfromID, to the Website_SupportSystem table. If you do this, your intermediate table now records a ternary relationship, of the kind many-to-many-to-many. If this reflects the reality, then so be it.

    If you want to relate SupportSystems and SupportPlatforms, just use the intermediate table as an intermediate table in the joins. You can even do a three way join to join all three entities via the intermediate table.

    An alternative would be to create another intermediate table, SupportPlatform_SupportSystem, with a pair of foreign keys, namely SupportSystemID and SupportPlatformID. If this reflects the reality better, so be it. Then you can join it all together with a five table join, if needs be.

    0 讨论(0)
  • 2020-12-12 04:10

    I would add a new column 'SupportPlatformId" to the "SupportSystem" table which lookup to the table "SupportPlatform", because "SupportSystem" to "SupportPlatform" is probably one-to-one or many-to-one.

    Hence: Website -> (via Website_SupportSystem) SupportSystem -> SupportPlatform

    0 讨论(0)
提交回复
热议问题