Database Reference
In-Depth Information
In this example, there are two entities: Schools and Deans. Each entity
has the attributes that are specific to those objects. Additionally, there is a
reference in the Deans entity that notes which school the selected dean
manages, and there is a reference in the Schools entity that notes the dean
for the selected school. This design helps with flexibility, because Deans
and Schools are managed separately. However, you can see that there is a
one-to-one relationship, and you can constrain the data appropriately to
avoid inconsistent or erroneous data.
One-to-Many Relationships
In one-to-many relationships, the most common type, a single record in
the first entity has zero or more matching records in the second entity.
There are numerous examples of this type of relationship, most notably in
the header-to-detail scenario. Often, for example, orders are stored with a
header record in one entity and a set of detail records in a second entity.
This arrangement allows one order to have many line items without stor-
ing multiple records containing the high-level information for that order
(such as order date, customer, etc.).
To continue our Schools and Deans scenario, what if a university de-
cides to implement a policy whereby each school has more than one dean?
This instantly creates a one-to-many relationship between Schools and
Deans, as shown in Figure 2.4.
F IGURE 2.4
Schools and Deans entities, a one-to-many relationship
 
Search WWH ::




Custom Search