Model Transformation

Given an ER Model, the next activity in the database design process is transformation of the logical representation expressed by the ER Model into a schema. For a relational database design this essentially means transformation into relational tables.

A series of transformation rules are presented below. These are for each of the entity types and relationship types discussed previously. This material should be read in conjunction with the readings outlined for Chapter 6 below.

Note: The phrase foreign key refers to a primary key that appears as an attribute/column of a table other than its own. Also, the terms parent and child refer to the entities that participate in 1:N relationships. The parent is the entity on the one side and the child the entity on the many side.

 

Strong Entities

For each strong entity:

Weak Entities

For each weak entity:

1:1 Relationships

For each binary 1:1 relationship:

1:N Relationships

For each binary 1:N relationship:

M:N Relationships

For each binary M:N relationship:

Notes:

  1. We may use the above rules to address recursive relationships. The only difference is that in the case of 1:1 and 1:N recursive relationships the foreign key is added to the same table. We usually choose a name for the foreign key that indicates its use. See pages 161 - 163.
  2. Subtype structures, or IS-A relationships, are a little different. For the tables corresponding to the subtypes, include the primary key of the table corresponding to the supertype. Let this key be the primary key of the subtype. Notice that each subtype instance corresponds to one and only one supertype instance and so the key of the subtype must be the same as the key of the supertype. See pages 165 - 167.
  3. Foreign keys will be NOT NULL except for 1:1 and 1:N relationships, when the minimum cardinality of the referenced table is zero, in which case the foreign key must allow for nulls.

 

Readings: Chapter 6, pg 151-163, 165-167