Modeling Optional Foreign Key from Composite Primary Key field (Oracle Data Modeler)

database-design

I am trying to add an optional foreign key in Oracle SQL Developer Data Modeler v4.1.0.873(Build 873), as per diagram below:

enter image description here

The issue is that I can only make such a relationship if it is mandatory (note solid black line – I need it to be dotted). The 'Mandatory' checkbox cannot be unchecked, or where it can be, I get:

MKT_DATA_BONDS__FK: FK cannot be optional because some columns are
part of the PK

How do I show this relationship in the model? (We don't want the BONDS table to contain all bonds). I tried adding an index (on BOND_ID) but wasn't able to reference that either.

Best Answer

You have the foreign key in the wrong table. Your defining entity is in the MKT_DATA_BONDS table. The refering entity is in the BONDS table. Each BOND must be defined in MKT_DATA_BONDS. The "optional" part is carried out by the fact that not all market bonds need be represented as a company bond.

To put it in OO language, market bond is the super or parent class. A company bond is one (of possibly several) sub or derived classes. Subclasses know about super classes, but the super class doesn't know about (or refer to) any subclass.