Database Management

Integrity Rules are imperative to a good database design. Most RDBMS have these rules automatically, but it is safer to just make sure that the rules are already applied in the design. There are two types of integrity mentioned in integrity rules, entity and reference. Two additional rules that aren't necessarily included in integrity rules but are pertinent to database designs are business rules and domain rules.

Entity integrity exists when each primary key within a table has a value that is unique. This ensures that each row is uniquely identified by the primary key. One requirement for entity integrity is that a primary key cannot have a null value. The purpose of this integrity is to have each row to have a unique identity, and foreign key values can properly reference primary key values.

Reference integrity exists when a foreign key contains a value and that value refers to an existing tuple/row in another relation. The purpose of reference integrity is to make it impossible to delete a row in one table whose primary key has mandatory matching foreign key values in another table.

Business rules are constraints or definitions created by some aspect of a business. They can apply to almost all aspects of a business and are meant to describe the operations of a business. An example of a business rule might be no credit check is to be performed on return customers. This example would change a database design for a car company.

Domain rules or integrity specify that all columns in a database must be declared upon a defined domain. A domain is a set values of the same value type.

Other integrity rules include not null and unique constraints. The not null constraint can be placed on a column to ensure that every row in the table has a value for that column. The unique constraint is restriction placed on a column to ensure that no duplicate values exist for that column.