Jun 25 2010

Entity Integrity in Your Data

Entity constraints ensure the integrity of the entities being modeled by the system. At the simplest level, the existence of a primary key is an entity constraint that enforces the rule “every entity must be uniquely identifiable.”

In a sense, this is the entity integrity constraint; all others are technically entity-level integrity constraints. The constraints defined at the entity level can govern a single attribute, multiple attributes, or the relation as a whole.

The integrity of an individual attribute is modeled first and foremost by defining the attribute against a specific domain. An attribute within a relation inherits the integrity constraints defined for its domain. At the entity level, these inherited constraints can properly be made more rigorous but not relaxed. Another way of thinking about this is that the entity constraint can specify a subset of the domain constraints but not a superset. For example, an OrderDate attribute defined against the TransactionDate domain might specify that the date must be in the current year, whereas the TransactionDate domain allows any date between the date business commenced and the current date. An entity constraint should not, however, allow OrderDate to contain dates in the future, since the attribute’s domain prohibits these.

Similarly, a CompanyName attribute defined against the Name domain might prohibit empty values, even though the Name domain permits them. Again, this is a narrower, more rigorous definition of permissible values than that specified in the domain.

1 Comments on this post

Trackbacks

  1. Referential Integrity in Relational Database | Free The Internet wrote:

    [...] is really only one referential integrity constraint: foreign keys cannot become orphans. In other words, no record in the foreign table can [...]

    July 26th, 2010 at 1:28 am

LEAVE A COMMENT

Subscribe Form

Subscribe to Blog

Spam Protection by WP-SpamFree