|
Model 1:
|
Model 2:
|
|
|
In Model 1, we will have the following entity instances:
Supplier Part Project
------------- ------------- -------------
s1 p1 pj1
s2 p2 pj2
|
and the following relationship instances:
Supply Uses Inventory
---------------- ---------------- ---------------
(s1, pj1) (pj1, p1) (s1, p1)
(s1, pj2) (pj1, p2) (s1, p2)
(s2, pj1) (pj2, p1) (s2, p1)
(s2, pj2) (pj2, p2) (s2, p2)
|
|
In Model 2, we will have the same entity instances:
Supplier Part Project
------------- ------------- -------------
s1 p1 pj1
s2 p2 pj2
|
But the relationship instances are different:
Supply
--------------------
(s1, p1, pj1)
(s1, p2, pj2)
(s2, p1, pj2)
(s2, p2, pj1)
|
|
But DO be aware that "drawing an extra line" in a ER-diagram has profound consequences....
|
|
|
we should use the following ER-model to represent the information:
|
Reason:
|
|
is more complicated using the ternary relationship:
|
You must remove duplicated facts when you count !!!
(E.g.: (s1, p1, pj1) and (s1, p1, pj2) says the same thing with regard to the posed query: that supplier s1 has p1 in his/her inventory)