Definition
Entity Relationship Model
An entity-relationship model (or ER model) describes interrelated things of interest in a specific domain of knowledge.
Entity Set
Entity Set
An entity set is a concrete set of entities of the same entity type.
All entities of the same entity type (or entity set) have the properties.
Entity
Entity
An entities is an object of the real world for which information is stored. Only properties of entities can be stored in a database, not the entity itself.
Weak Entity
A weak entity’s partial key (discriminator) is marked by underlining with a dashed line.
Example:
Attribute
Attribute
Single-Valued Attribute
Single-Valued Attribute
An attribute is called single-valued if it accepts only one concrete value.
Multi-Valued Attribute
Single-Valued Attribute
An attribute is called multi-valued if it accepts a collection of values.
Composite Attribute
Composite Attribute
An attribute is called composite if is consists of multiple sub-attributes.
Example:
Derived Attribute
Derived Attribute
Key
Primary Key
Primary Key
A primary key is a key candidate that identifies an entity uniquely.
Relation
Weak Relation
Cardinality
Chen Notation
The Chen notation restricts the number of entities produced by a relationship (combination of entities).
Example: What can be said about this relation?
- One professor and one seminar topic produce students.
- One student and one professor produce seminar topic.
- One student and one seminar topic produce professor.
[min, max] Notation
Restricts the number of times an entity can participate in a relationship.
Example: What can be said about this relation?
- One professor can supervise an arbitrary number of students and seminar topics.
- One student can be supervised by an arbitrary number of professors and supervised about an arbitrary number of seminar topics.
- One seminar topic can be included in an arbitrary number of supervisions.
Participation
Total Participation
Each entity of an entity type must participate in a relationship, i.e., it cannot exist with any participation.
Example: 1:N relationship type with total participation of entity type wine
Example: 1:N relationship with total participation of both involved entity types
Partial Participation
Each entity of an entity type can participate in a relationship, i.e., it can exist without any participation.
Example: 1:1 relationship type with partial participation
IS-A
Total IS-A
Total IS-A
Every less-specialised entity type must be owned by a specialised entity type.
Partial IS-A
Partial IS-A
Every less specialised entity type can (but doesn’t have to) be owned by a specialised entity type.
Specialisation
Example: Each sparkling wine entity is associated with exactly one wine entity. The sparkling wine adds a new attribute production as specialisation to the existing “inherited” wine attributes.
Note that not all wines have to sparkling wines:
Overlapping Specialisation
An entity may belong to multiple specialised entity sets.
Disjoint Specialisation
An entity may belong to at most one specialised entity set.
Generalisation
Generalisation by Main Classes
Generalisation by Main Classes
A particular entity is mapped to a single tuple in a single relation (to its main class).
Link to original
- employee: {[ empID, name ]}
- employees that are neither professor nor assistants*
- professor: {[ empID, name, rank, officer ]}
- employees that are only professors
- assistant: {[ empID, name, department ]}
- employees that are only assistants
Generalisation by Partitioning
Generalisation by Partitioning
Parts of a particular entity are mapped to multiple relations, the key is duplicated.
Generally speaking, this is the most used variant of generalisation.
Link to original
- employee: {[ empID, name ]}
- all employees
- professor: {[ empID → employee, rank, officer ]}
- additional info for employees that are professors
- assistant: {[ empID → employee, department ]}
- additional info for employees that are assistants
Generalisation by Full Redundancy
Generalisation by Full Redundancy
A particular entity is stored redundantly in the relations with all its inherited attributes.
Link to original
- employee: {[ empID, name ]}
- all employees
- professor: {[ empID, name, rank, officer ]}
- all employees that are professors
- assistant: {[ empID, name, department ]}
- all employees that are assistants
Generalisation by a Single Relation
Generalisation by a Single Relation
All entities are stored in a single relation. An additional attribute encodes the membership in a particular entity type.
Link to original
- employee: {[ empID, name, type, rank, office, department ]}