# 5.4 Optionality

The optionality, or also called obligation (with opposing semantics), denotes whether a relationship is mandatory or only optional. Conceptually, the optionality means, that a related entity may not exist, may not be available, or may not be applicable - whichever interpretation you can come up with. Technically, the optionality represents the lower bound of the number of entities that are related to each other. The optionality always appears on both relationship ends. The latter is especially important when trying to understand backward optionalities.

There's no definition which one the forward or backward optionalities are. Forward optionalities are the ones you find more natural or easier to understand. It's probably easiest to start by asking into the direction of the parts, from the whole. One-to-many relationships are the easiest in that matter: the forward optionality is always at the "many" end. I also found, that it's very easy to determine the optionalities in logical or physical models, where all many-to-many relationships have been replaced by a "join table" and two one-to-many relationships. One-to-many is the most frequent cardinality by far.

Remember, the optionality is merely an indicator for the number of entities an entity is related to. This can be asked into both directions of the relationship, independently of who references who. Example: if you demand a basketball roster to have at least five team members, the optionality is not given (the lower bound is five). If you reverse the logic, you'd ask: how many rosters does a team member entity relate to? Well, a team member doesn't make much sense without a team, so the minimum number of rosters is one and hence the backward optionality is zero.

The original Chen notation didn't include optionality and thus, there is no official symbol to represent them. However, you can easily extend the Chen notation by writing "0,1", "0,N", and "O,M" instead of just "1", "N", and "M" to add optionality. Like this, you are 100 percent compatible with the UML. By using this extension, you can also specify the full cardinalities. The following image shows the generally possible optionalities in conjunction with cardinalities:

In ER notation, the combination of cardinality and optionality is called complexity. The UML also defines this combined term and calls it multiplicity. Technically, the cardinality stands for the upper bounds while the optionality represents the lower bounds.

Optionalities aren't hard to understand in the forward direction, but they can confuse in the backward direction, if you've never really dealt with them. I'll show how concrete cardinalities and optionalisites are be implemented via SQL in section 13.4 Modeling Relationships.

Last updated: 2010-10-13