Home Mongo DB Solution Integrity Constraints

Integrity Constraints

(The rules that should not be violated while performing an operation on the database)

Integrity constraints ensure that changes made to the database by authorized users do not result in a loss of data consistency. Thus, integrity constraints guard against accidental damage to the database.

Simple Constraints are Key Constraints and forms of Relationships Constraints.

The relational data model includes several types of constraints, or business rules, whose purpose is to facilitate maintaining the accuracy and integrity of data in the database. The major types of integrity constraints are domain constraints, entity integrity, and referential integrity.

Integrity Constraint:

Database designers can specify integrity constraints that are enforced by the DBMS. A constraint is a rule that cannot be violated by database users (ie. Also called a business rule).

(controlling data integrity)

For many DBMS data, integrity constraints ( ie. Control on the possible value a field can assume) can be built into the physical structures of the fields. The data type enforces one form of data integrity control. Since it may limit the type of data (for eg:- numeric or character, data type) and length of a field value. Some typical integrity constraints control that a DBMS may support are:-

Default Value:- A default is a value a field will assume unless a user enters an explicit value. For an instance of that field. Assigning a default value to a field can reduce a data entry time since the entry of a value can be skipped and it can also help to reduce data entry errors for that most common value.

Range Control:- A range control limits the set of permitted values, a field may assume. The range may be a numeric lower to upper bound or a set of specific values. Range control must be used with caution since the limits of the range may change over time.

NULL value control:- Each primary key must have an integrity control that prohibits null value. Any other required fields may also have invalid value control placed on them if that is the policy of the organization.

Referential Integrity:- Referential Integrity on a field is a form of range control in which the value of that field must exist as the value in some field in another row of the same or different table. ie. The range of legitimate values comes from the dynamic contents of the field in a database table, not from the pre-specified setup values.

An integrity constraint is that the value of an attribute in one relation depends on the value of a primary key in the same or another relation.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Exit mobile version