Database Reference
In-Depth Information
INVOICE
paid by
PAYMENT
1
1
One invoice is paid by one payment.
One payment pays one invoice.
1
A
2
B
3
C
Figure 6-8
Relationship cardinality: one-to-one.
CUSTOMER
places
ORDER
*
1
One customer places many orders.
One order is placed by only one customer.
1
2
A
3
4
B
5
C
6
7
Figure 6-9
Relationship cardinality: one-to-many.
Observing from the CUSTOMER side, one instance of the object CUSTOMER
is related to many instances of the other object ORDER. Again, observing from the
ORDER side, one instance of object ORDER is related to only one instance of the
other object CUSTOMER. So is the relationship one-to-many, or many-to-one? It
appears to be both. Conventionally, this type of relationship is only referred to as
a one-to-many relationship, and not the other way round.
Many-to-Many Relationship Consider an example of the relationship
between the objects EMPLOYEE and PROJECT. Let us say that an employee
may be assigned to several projects. Also, a project may have many employees.
What is the nature of the association between instances of EMPLOYEE and
PROJECT? Figure 6-10 presents this many-to-many relationship where the
cardinality is *:*.
Search WWH ::




Custom Search