Convert table to sub-table
Is this possible? If so, how?
8 replies
-
Generally speaking .. make a composit relationship.
-
Hum, I don't know what that means, could you explain further?
-
Sure.. Assume you have two tables.. Parent and Child.. and there is a relationship from Child back to parent.
This is current "composition = no"
Flip it to YES
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)
-
Sure.. Assume you have two tables.. Parent and Child.. and there is a relationship from Child back to parent.
This is current "composition = no"
Flip it to YES
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)
-
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.
-
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:
-
@Mr K.. I agree.. Your Primer and Mortar tables should just be associations.. LIke your Thinset Mortar .. Grout.. etc.
-
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
- 5 yrs agoLast active
- 8Replies
- 2269Views