CS457 Syllabus & Progress

## Entity-Relation Diagrams

• ER-Diagrams

• An ER-diagrams is a graphical representation of an ER-model

• Humans - for one reason or another - grasp information more easily when information is depicted in a graphical manner

• Representing Entities

• An entity type is represented by a rectangle

• A simple-valued attribute is represented by a oval

• A multi-valued attribute is represented by a double oval

• A key attribute is underlined

• Schematically:

• Example: representation of the department entity

• Representing WEAK Entities

• An weak entity type is represented by a double rectangle

• Schematically:

• Example: representation of the dependent entity

Notice there are no key attributes in a weak entity type

• Representing Relationships

• A relationship type is represented by a diamond

• A line is drawn from the relationship type to each participating entuty type:

1. A partial participation is represented by a single line

2. A total participation is represented by a double line

• Cardinality ratio constraint in a relationship type is represented by a value on the participation line

1. 1 means that at most 1 (0 or 1) entity of the other entity type is associated with an entity

The value can be any fixed constant, e.g.:

2 means that at most 2 (0, 1 or 2) entities of the other entity type is associated with an entity

2. N means that any number of entities of the other entity type is associated with an entity

• Schematically:

The cardinality ratio depicts the fact that:

• ONE entity of type entity1 can be associated with N entities of entity2
• ONE entity of type entity2 can be associated with at most 1 entity of entity1

• Example: the "Control" relationship

Participation constraints:

• Department: partial
• Project: total

Cardinality ratio constraints:

• ONE Department can control N Projects
• ONE Project is controlled by at most 1 entity1

(NOTE: because the participation of Project is total, we know that at most 1 is in fact always 1)

• Representing WEAK Relationships

• A weak relationship type is represented by a double diamond

• Schematically:

• We will see an example of weak relationship type in the full ER-diagram of the company database next

• ER-Diagram of Company Database

• The following diagram is the ER-diagram of the Company Database with the specifications given on this webpage: click here

• The diagram should be "self-explanatory" with the notes above....

• Homework Assignment

• It's time to do Paper Homework 1: click here to re-inforce ER-diagram.