Week 4 Lecture 1

Participation constraints

Enforcing each entity in an entity set to participate in the relationship at least one. For example, we might want to say that there should not be a car without an owner. This is indicated by a double line at the side of the participation.


Relationship roles

Sometimes, both sides of the relationship are the same entity set. To ensure that the relationship is modelled correctly, distinguish the role of each entitiy set in the relationship.


  • At most, how many workers can work for them?
  • At most, how many managers can they work for?

Keys for entity sets

An entity set has several attributes. Among these, certain attributes allow for the unique identification of an entity within an entity set.

A super key of an entity set is a set of one or more attributes whose values uniquely determine each entity. A candidate key of an entity set is a minimal super key. Although several candidate keys may exist, one of the candidate keys is selected to be the primary key. In an ER diagram, the primary key is underlined.

  • Underlined - Primary key
  • Indent - Composite attribute components
  • Set valued attributes ( { and } on either side) - Multiple attributes possible
  • Round brackets after attribute () - Attribute than can be calculated using other attributes.


An entity set without a key of its own is a weak entity set. In the book-chapter relationship, a chapter is uniquely identified by its chapter number within a book. In this example, the primary key of the chapter entity set is the chapter number and the primary key of the book entity set.


The discriminator attribute is identified by a dotted underline. The identifying relationship is indicated by a double border around the relationship set


  • Weak entity set: An entity set that does not have a primary key
  • Identifying entity set: The relationship set that a weak entity set depends on (which is a strong entity set)
  • Discriminator (or partial key): The set of attributes that distinguishes among all of the entities of a weak entity set that depends on a particular strong entity

The primary key of a weak entity set is formed by the primary key of the strong entity set on which the weak entity set's existence depends, plus the weak entity set's discriminator.

Example ER Model