Integrity of relational database relationships

Source: Internet
Author: User

1. Relationship: A subset of D1XD2X...XDN is called in the domain d1,d2,... The relationship on the DN, expressed as R (D1,d2,... Dn), R denotes the name of the relationship, and N is the order or degree of the relationship. Each element in a relationship is a tuple in a relationship.
2. There are three types of integrity constraints in the relational model: entity integrity, referential integrity, user-defined integrity . The entity integrity and referential integrity are the integrity constraints that the relational model must satisfy, which is called the two invariance of the relationship and should be automatically supported by the relational system. User-defined integrity is a constraint that needs to be followed in the application domain, which embodies the semantic constraints in the specific domain.
3, Entity integrity rules: If the attribute (refers to a property or a set of properties) A is the primary property of the basic relationship R, then a cannot take a null value. The so-called null value is a value that "does not know" or "does not exist".
According to the Rules of entity integrity, the main code of the basic relationship cannot be controlled. If the main code consists of several attributes, none of the primary properties can take a null value.
For Entity Integrity Rule descriptions:
(1), Entity integrity rules are for basic relationships. A basic table usually corresponds to an entity set in the real world. If the student relationship corresponds to the student's collection.
(2), real-world entities are distinguishable, that is, they have a certain unique identity. For example, each student is a separate individual, is not the same.
(3), the main code as a unique identity in the relational model.
(4), the attribute in the main code, that is, the primary attribute cannot take null value, if the main attribute takes a null value, it means that there is an entity that is not identifiable, that is, there is an entity that is not distinguishable, which is inconsistent with (2), so this rule is called entity integrity.
4, referential integrity: (1) Set F is the basic relationship r of one or a set of properties, but not the code of the relationship R. K is the main code of the basic relationship s. If f corresponds to K, it is said that F is the outer code of R (foreign key). The basic relation R is referred to as the reference relation. The basic relationship S is the referenced relationship. The external code does not have to have the same name as the corresponding master code.
(2) If the attribute (or attribute group) f is an outer code of the basic relationship R, it corresponds to the main code K of the basic relationship s (the basic relationship R and S does not necessarily have a different relationship), then the value of each tuple on F in R must be:? or a null value (each property value of f is null)? or equal to the primary code value of a tuple in S.

Integrity of relational database relationships

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.