...

/

Integrity Rules and Constraints

Integrity Rules and Constraints

In this lesson, we will discuss the different types of constraints present on relational databases.

Constraints are a very important feature in a relational model. In fact, the relational model supports the well-defined theory of constraints on attributes or tables. Constraints are useful because they allow a designer to specify the semantics of data in the database. Constraints are the rules that force DBMSs to check that data satisfies the semantics.

Relational integrity constraints

Relational integrity constraints are the conditions that must be present for a valid relation. These integrity constraints are derived from the rules in the mini-world that the database represents.

There are many types of integrity constraints, but we will focus on the following:

Domain constraints

Domain constraints specify that within each tuple, the value of each attribute must appear in the corresponding domain (in other words, it should belong to the appropriate data type). We have already discussed how domains can be specified in the previous lessons. The data types associated with domains typically include integers, real numbers, characters, booleans, ...