Single-Value Constraints

Single-Value Constraints

Sometimes, an important property of a database design is that there is at most one value playing a specific role. For instance, we assume that a movie entity has a unique title, year, length, and film type, and that a movie is owned by a unique studio.

There are many ways in which single-value constraints are expressed in the E/R model.

1. Each attribute of an entity set has a single value. Often it is permissible for an attribute's value to be missing for a number of entities, in which case we have to invent a "null value" to serve as the value of that attribute. For instance, we might assume that there are some movies in our database for which the length is not known. We could use a value such as -1 for the length of a movie whose true length is unknown. On the other hand, we would not want the key attributes title or year to be null for any movie entity. A requirement that a certain attribute not have a null value does not have any special representation in the E/R model. We could place a notation beside the attribute stating this requirement if we wished.

2. A relationship R that is many-one from entity set E to entity set F implies a single-value constraint. That is, for each entity e in E, there is at most one associated entity f in F. More generally, if R is a multiway relationship, then each arrow out of R indicates a single value constraint. Specifically, if there is an arrow from R to entity set E, then there is at most one entity of set E associated with a choice of entities from each of the other related entity sets.



Tags