# Relationships & Relationship Sets

# Relationships & Relationship Sets

A **relationship** is an association between several entities.

A **relationship set** is a set of relationships of the same type.

**Formally** it is a mathematical relation on (possibly non-distinct) sets.

If are entity sets, then a relationship set R is a **subset** of

where is a relationship.

For example, consider the two entity sets *customer* and *account*. (Fig. 2.1 in the text). We define the relationship *CustAcct* to denote the association between customers and their accounts. This is a **binary** relationship set (see Figure 2.2 in the text).

Going back to our formal definition, the relationship set *CustAcct* is a subset of all the possible customer and account pairings.

This is a binary relationship. Occasionally there are relationships involving more than two entity sets.

The **role** of an entity is the function it plays in a relationship. For example, the relationship *works-for* could be ordered pairs of *employee* entities. The first employee takes the role of manager, and the second one will take the role of worker.

A relationship may also have **descriptive** attributes. For example, *date* (last date of account access) could be an attribute of the *CustAcct* relationship set.