The Entity/Relationship Model

San Skulrattanakulchai

March 19, 2019

E/R Diagram

Examples

Terms

Terms

Multiway relationships

Attributes on relationships

Eliminating attributes on relationships

Converting k-way relationships to k binary relationships

Subclasses

Design Principles

  1. The design must be faithful to specifications. The designer needs to know about the real world she is modeling. Which of these is faithful?

Design Principles

  1. Redundancy should be avoided. What’s wrong?

Design Principles

  1. Choose a simple design whenever possible.
  2. Choose the right relationships. If a relationship can be deduced from existing relationships, do not add it to the design.
  3. Picking the right kind of element. A common decision to be made is choosing between using attributes and using entity set/relationship combinations. You should use an entity set if at least one of the following conditions hold: (i) it has at least one nonkey attribute, or (ii) it is the “many” in a many-one or many-many relationship.

Primary key constraints

Referential integrety and cardinality constraints

Weak Entity

Converting an ERD to relational database schema

Combining relations

Example combining relations

we can combine the relations Movies(title, year, length, genre) and Owns(title, year, studioName) into one relation Movies(title, year, length, genre, studioName).

Weak entity sets

Rename attributes, if necessary, to avoid name conflicts.

Converting subclasses structures to relations

Example conversion