What are the integrity constraints of database design?
What are the integrity constraints of database design? Here are four aspects:
1. Domain integrity:The columns in the database table must meet certain data types or constraints. The constraints include the value range and accuracy. Use Check to implement constraints. In the database design tool, when defining the value range of a field, there is a Check button that defines the Value City of the field.
2. Integrity of reference:Defines the reference rules between the external code and the primary code. It is implemented using PK, FK, and table-level triggers. The principle rule is that if attribute (or attribute group) f is the external code of the basic relationship r, it corresponds to the primary code ks of the basic relationship s (the basic relationship r and s are not necessarily different), then the value of each tuples in r on f must be: or take a null value (each attribute value of f is null) or equal to the primary code value of a tuples in s.
3. entity integrity rules ):If attribute a is the primary attribute of basic link r, attribute a cannot be null. Because entity integrity rules are for basic relationships. A basic table usually corresponds to an entity set or many-to-many relationship in the real world. The relationships between entities and entities in the real world are differentiated, that is, they have some unique identifier, and the relational model of database design must comply with the entity integrity rules.
4. User-Defined integrity:User-Defined integrity is a constraint on a specific relational database, reflecting the semantic requirements that must be met by the data involved in a specific application. The relational model should provide mechanisms to define and test such integrity so that they can be processed in a unified and systematic manner, rather than undertaken by applications. It is a business rule that is implemented using stored procedures and triggers.
The above is all the content of this article, hoping to help you learn.