- Learning PostgreSQL 10(Second Edition)
- Salahaldin Juba Andrey Volkov
- 132字
- 2021-07-02 22:42:03
Constraint
The relational model defines many constraints in order to control data integrity, redundancy, and validity:
- Redundancy: Duplicate tuples are not allowed in the relation.
- Validity: Domain constraints control data validity.
- Integrity: The relations within a single database are linked to each other. An action on a relation such as updating or deleting a tuple might leave the other relations in an invalid state.
We could classify the constraints in a relational database roughly into two categories:
- Inherited constraints from the relational model: Domain integrity, entity integrity, and referential integrity constraints.
- Semantic constraint, business rules, and application specific constraints: These constraints cannot be expressed explicitly by the relational model. However, with the introduction of procedural SQL languages such as PL/pgsql for PostgreSQL, relational databases can also be used to model these constraints.