0

Convert table to sub-table

Is this possible? If so, how?

8 replies

null
    • Mconneen
    • 4 yrs ago
    • Reported - view

    Generally speaking .. make a composit relationship. 

    • Mr_K
    • 4 yrs ago
    • Reported - view

    Hum, I don't know what that means, could you explain further? 

    • Mconneen
    • 4 yrs ago
    • Reported - view

    Sure..  Assume  you have two tables.. Parent and Child.. and there is a relationship from Child back to parent.

    relatedNotSubtable

    This is current "composition = no"

    notComposite

    Flip it to YES

    makecomposit

    subtable

     

    If your starting point is that you have rows in Parent .. and rows in Child... and NO relationship at all... You can still make the relationship.. make it composite ... and then have a script that scans the child and populates the parent .. exactly what that scan looks like will depend on your foreign key relationship(s)

    • Mconneen
    • 4 yrs ago
    • Reported - view

    Sure..  Assume  you have two tables.. Parent and Child.. and there is a relationship from Child back to parent.

    relatedNotSubtable

    This is current "composition = no"

    notComposite

    Flip it to YES

    makecomposit

    subtable

     

    If your starting point is that you have rows in Parent .. and rows in Child... and NO relationship at all... You can still make the relationship.. make it composite ... and then have a script that scans the child and populates the parent .. exactly what that scan looks like will depend on your foreign key relationship(s)

    • Mr_K
    • 4 yrs ago
    • Reported - view

    Thanks. I see how it's done. I have to work on my database. So far it's working backward. I'll play with it and report back.

    • Mr_K
    • 4 yrs ago
    • Reported - view

    I see my problem. I have a "House" database. I have these tables; Tile, Mortar, Grout, Caulk. All are related to tile. I keep thinking the Tile table should be the parent, but it's not since a mortar, grout, and caulk can be used with many different tiles. I also have a "Paint" table with a "Primer" sub-table, and I think that is wrong too because a primer can be used on many different paints. So I think the "Primer" table should be the parent. Does this make sense?

    This is how it looks now in the data model:

    • Mconneen
    • 4 yrs ago
    • Reported - view

    @Mr K.. I agree.. Your Primer and Mortar tables should just be associations.. LIke your Thinset Mortar .. Grout.. etc.   

    • Mr_K
    • 4 yrs ago
    • Reported - view

    I'm experimenting with a test database. I see that with sub-tables the common element needs to be the parent. In my case that is not what I want to see, so for this database sub-tables are not the way to go.

Content aside

  • 4 yrs agoLast active
  • 8Replies
  • 2151Views