Hi,
After creating a relationship, the attributes of the PK of the parent table automatically become PFK’s for the child table. Is there any way for me to migrate just part of the PK to the child table?
For example, say the parent table’s PK contains attrib1 and attrib2. I would like to create a relationship and migrate only attrib2 to the child table as the PFK. Is that possible with TMD?
Thanks!
Hello,
Take the following steps:
- Edit the parent entity | Keys tab and add another key K2- alternate key.
- Edit the key K2 and add only attrib2 to it.
- Edit the relationship | Foreign Keys tab and from the Parent Key box, select K2.
If you have more questions, please write me back. Thanks.
Regards,
Vladka
Thanks for your reply. What if I wanted a non-identifying relationship?
For example:
Parent table:
Attrib1 NN PK
Attrib2
Child table:
Attrib1 NN PFK
Attrib2
Now I would like to make Attrib2 of child table reference to Attrib2 of parent table, and parent’s Attrib2 is not necessarily unique. Creating a key2 containing Attrib2 would make it unique and that’s not what I want.
Thank you again!
Hello,
Thanks for your reply.
I’m sorry, I don’t understand what exactly you mean.
When I take the steps I described in my previous post, no matter if I have identifying or non-identifying relationship, the child attribute is not unique. (For identifying relationship, it is NN.)
Also, I’m not sure if you already have the Attrib2 in child entity before you create relationship. (In this case, FK mapping can be used.) And if this thing is connected with what you ask about or not.
Please find attached a doc.
If I’ve completely misunderstood, please write me back (some screenshot will be appreciated). Thanks.
Movie on FK Mapping: http://modeling.inside.quest.com/entry.jspa?externalID=1668&categoryID=158
Regards,
Vladka
AK.pdf (197 KB)
Sorry I didn’t make my question very clear. What I meant was that, by making the parent attribute an AK, the parent attribute gets a unique constraint, and I don’t want that.
Thank you for your demo by the way.
Hi,
Just a quick question: If you added two identical records to Attribute2 column in parent table and then tried to add a record to Attribute2 column in child table, how would you find the right record? I guess this would be problematic.
Regards,
Vaclav