Database integrity and database integrity constraints

Source: Internet
Author: User

Database integrity and database integrity constraints
Database integrity
Database integrity refers to the correctness and compatibility of the database. data correctness refers to the accuracy of the database value, that is, the data type must be correct and the data value should be within the specified range.
Data compatibility is the existence of exponential data. It is necessary to ensure the compatibility between tables and different table data.
There are three types of integrity constraints in relational databases: entity integrity, referential integrity and user-defined integrity. Integrity and referential integrity are the integrity constraints that must be met by the database.
And the User-Defined integrity can be determined based on the actual situation.
Entity integrity:
The entity integrity system is the uniqueness of all entities in the database. entity integrity can be implemented through primary keys, indexes, unique values, and other methods.
Primary keys are usually used for integrity.
Integrity of reference:
Integrity refers to the relationship between entities and entities. It is also a way for users to maintain data consistency between related data tables,
Integrity of reference can be used to prevent data unavailability errors in other data tables due to data modification or deletion of a data table.
Methods that can be used to achieve the integrity of the reference include foreign keys, triggers, and stored procedures.
Custom integrity:
You can customize constraints in actual applications based on actual conditions. It reflects the semantic requirements that must be met by the data involved in a specific application.
The following methods can be used to implement user-defined Integrity: Rules, triggers, stored procedures, and all constraints that can be used when data tables are created.

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.