Database Reference
In-Depth Information
ClntNo
ContactNo
ContactName
ClntName
1
1
assigns
CONTACT
PERSON
CLIENT
ClntAddr
ContactPhone
Relational Notation
CLIENT ( ClntNo , ClntName, ClntAddr)
CONTACT PERSON ( ContactNo ,ContactName, ContactPhone, ClntNo)
Foreign Key: ClntNo REFERENCES CLIENT
CLIENT relation
ClntNo
ClntName
ClntAddr
11111
ABC Industries
6 William Street, Jamesburg, NJ 08810
22222
Progressive Systems
1 Bradford Place, Iselin, NJ 08834
33333
Rapid Development
47 Woods Drive, Edison, NJ 08817
44444
Richard Associates
55 Walker Lane, Metuchen, NJ 08819
Quality Consulting
55555
35 Rues Ave., E. Brunswick, NJ 08821
CONTACT PERSON relation
ContactNo
ContactName
ClntNo
ContactPhone
123
Mary Williams
732-345-8100
22222
11111
55555
234
Winston Poyser
Lisa Moore
732-555-4000
345
732-767-5300
Figure 9-8
Better transformation of one-to-one relationship.
CustNo
OrderNo
OrderDate
CustName
1
*
places
CUSTOMER
ORDER
CustAddr
OrderAmount
1
2
3
4
5
6
1111
1112
1113
Figure 9-9
CUSTOMER and ORDER: one-to-many relationship.
It does not really matter whether you place the foreign key column in one table
or the other. However, to avoid wasted space, it is better to place the foreign
key column in the table that is likely to have fewer rows.
One-to-Many Relationships
Let us begin our discussion of the one-to-many relationship by reviewing
Figure 9-9. This figure shows the one-to-many relationship between the two objects
CUSTOMER and ORDER.
Search WWH ::




Custom Search