Entity Relationship Modeling - Three types of relationships
(Page 6 of 21 )
One-to-one relationships
One-to-many relationships
Many-to-many relationships
For each relationship type, we may have one or both ends optional or mandatory, which give us a total of 10 different theoretical variations of relationships between entities. However; some of them are actually impossible logically, and a few other are so far-fetched that you probably have some less well-thought constructs in your analysis if you need them.
One-to-one relationships
Mandatory-mandatory

This relationship says; a given product MUST come from one and only one supplier product. A given supplier product MUST be the origin for one and only one product.
It sounds right, but it is not. If the supplier product is the origin of one single product, then the attributes of the supplier product most likely should be included in our product entity. Furthermore, we can deduct from this model that we cannot enter a NEW product unless a supplier product exists. However, we cannot enter a NEW supplier product before it has a product to relate to. It is a deadlock: We will never be able to enter anything into these two entities (when they become tables). This will do us no good; it is a result of theory, and not practice.
Mandatory-optional

This one is a little more flexible: a product MAY come from one and only one supplier product; however, a given supplier product MUST BE the origin of one and only one product. See the above relationship on how to solve this properly.
Optional-optional

At last some freedom: A given product MAY come from one and only one supplier product, and a supplier product MAY BE the origin of one and only one product.
Next: Supplier Entity >>
More Development Cycles Articles
More By Alf A. Pedersen