Relational database integrity

Source: Internet
Author: User

Relational database integrity

1. Relationship: D1 × D2 ×... * The subset of Dn is called in the domain D1, D2 ,... The relationship on the Dn, expressed as R (D1, D2 ,... Dn), R indicates the name of the link, and n indicates the link ContentsOr Degrees. Each element in the link is a tuples in the link.
2. There are three types of integrity constraints in the relational model: Entity integrity, referential integrity, and user-defined integrity. Entity integrity and reference integrity are relational models. RequiredThe satisfied integrity constraints are called the two immutability of the relationship and should be automatically supported by the relational system. User-Defined integrity is a constraint that must be observed in the application field, reflecting semantic constraints in specific fields.
3. entity integrity rules: If attribute (one or more attributes) A is the primary attribute of basic link R, A cannot be null. Null is the value of "unknown" or "nonexistent.
According to the entity integrity rules, the master code of the basic link cannot be controlled. If the primary code consists of several attributes, all these attributes cannot be null.
Entity integrity rules:
(1) entity integrity rules are for basic relationships. A basic table usually corresponds to an entity set in the real world. For example, the Student Relationship corresponds to the set of students.
(2) entities in the real world are differentiated, that is, they have some unique identifier. For example, each student is an independent individual and is different.
(3) The primary code is used as the unique identifier in the relational model.
(4) attributes in the primary code, that is, the primary property cannot take null values. If the primary property takes null values, it indicates that an unidentifiable entity exists, that is, an unidentifiable entity exists, this is in conflict with (2). Therefore, this rule is called Entity integrity.
4. Integrity of reference: (1) set F to one or more attributes of the basic relational R, but not the code of the relational R. K is the master code of basic link S. If F corresponds to K, F is the R external code (foreign key ). It is also called the basic link R as the reference link. The basic link S is the referenced link. The external code does not have to have the same name as the corresponding primary code.
(2) If attribute (or attribute group) F is the external code of the basic relationship R, it corresponds to the primary key 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.