Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Introduction to three kinds of database integrity constraints

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Today, the editor shares with you the introduction of three kinds of database integrity constraints. I believe many people do not know much about it. In order to make you understand better, I have summarized the following contents for you. Let's look down together. I'm sure you'll get something.

There are three kinds of integrity constraints of the database: (1) entity integrity, the uniqueness of the records in the relationship, that is, the constraint of the primary key; (2) the referential integrity, the constraint of the data reference between the data tables that establish the relationship in the relational database, that is, the constraint on the foreign key; (3) the integrity of the user definition, the constraint condition of a specific relational database.

Three kinds of Integrity constraints in Relational Model

1. Entity integrity

two。 Referential integrity

3. User-defined integrity

Entity integrity

If attribute An is the primary attribute of the basic relation R, attribute A cannot take a null value.

Entity integrity stipulates that all primary attributes of the basic relationship cannot be null.

Referential integrity

External code: in relation R, there is an attribute or set of attributes that is not the master code, and this attribute corresponds to the master code in another relation S. Then the attribute is the outer code of R.

The attribute or attribute group can be associated with the master code of the current relationship.

For example, the prerequisite course number in the figure below is associated with the course number.

Referential integrity states that the outer code is either null or equal to the main code value in another relationship.

User-defined integrity

1.unique (unique)

2.check (satisfies a condition)

3.not null (not null)

User-defined integrity is a constraint for a specific relational database. Reflect the semantic requirements that the data involved in a specific application must meet.

There are no uniform rules for user-defined integrity, which are created by database designers according to the semantic requirements of the data in specific applications.

This is the end of the introduction of the three database integrity constraints. I hope the above content can be of certain reference value to everyone and can be put into practice. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report