Database Design

ER Model -> Entity Relational Data Model -> Implementation

Below is a subset of the rules that should be followed when Designing the Database.
1) Build the ER-Model
a) Enities are squares, Attributes are Ovals, show cardinality, and show keys.
2) Transform ER-Model into relational model.
a) Make what looks like the column headings for each entity of the ER-Model.
b) The attributes that are part of a composite attribute are all listed out.
c) Multi-valued attributes are put into a new entity with 2 primary keys; one key comes from the original relation and the second is the value.

d.1) One-to-Many unary relationships produce a Relational Schema that adds an additional attribute that suggests the relationship. (like student represents student; so add an entity that has an attribute like StudentRep).

d.2) Many-to-Many unary relationships produce a Relational Schema that adds an additional entity with 2 primary keys that has the original primary key and a new primary key that has the same domain as the original primary key (but the name suggests the relationship).

d.3) One-to-One binary relationship has some unique ways to handle the referential integrity constraint, and also some interesting ways to remember it.
Mandatory side migrates to the optional side

One migrates to the many

d.4) Many-to-Many binary, ternary, and greater relationships require the creation of a associative entity and its corresponding attributes. The attributes of the associative entity include the attributes of the relation itself and the primary keys of the entities involved in the relationships.


Definition: Foreign Keys and Referential Constraints: Referential Constraints ensures that the foreign key values of a relation must come from the primary key values of the related relation; otherwise, the value of a foreign key must be NULL .

The images in this post were taken from Arizona State University IEE 305 Class Notes.