Database Learning (2)

1. Data Integrity

1.1 Database Integrity

        It is used to ensure that the data stored in the database is valid, that is, the validity and accuracy of the data.

        Ensuring Data Integrity = Add constraints to tables when they are created.

        Classification of completeness:

        - entity integrity (row integrity);

        - domain integrity ( column integrity);

        - Referential integrity (relational table integrity):

                Primary key constraint: primary key

                Unique constraint: unique [key]

                Not-null constraint: not null

                Default constraints: default

                Automatic growth: auto_increment

                Foreign key constraint : foreign key

                Recommendation: These constraints should be set when creating the table

                Note: Use spaces between multiple constraints

1.2 Entity Integrity

        Entity: that is, a row (a record) in the table represents an entity (entity)

        The role of entity integrity: to identify that each row of data is not repeated

        Constraint types: primary key constraints, unique constraints, auto-growth columns

1.2.1 Primary key constraint (primary key)

Not perfect, to be updated!

Supongo que te gusta

Origin blog.csdn.net/weixin_38817361/article/details/123126758
Recomendado
Clasificación