1. The Integrity Constraint of the database is a check measure for data updating. One or more constraints exist on a data table. 2. There are five types of constraints: NOTNULL, UNIQUE, PRIMARYKEY, CHECK, and FOREIGNKEY ). 3. Define the constraints
1. The Integrity Constraint of the database is a check measure for data updating. One or more constraints exist on a data table. 2. constraints are divided into five types: non-NULL constraint (not null), UNIQUE constraint (UNIQUE), primary key constraint (primary key), CHECK constraint (CHECK ), foreign key constraint (foreign key ). 3. Define the constraints
1. The Integrity Constraint of the database is a check measure for data updating. One or more constraints exist on a data table.
2. constraints are divided into five types: non-NULL constraint (not null), UNIQUE constraint (UNIQUE), primary key constraint (primary key), CHECK constraint (CHECK ), foreign key constraint (foreign key ).
3. When defining constraints, you can use the CONSTRAINT keyword to set the CONSTRAINT name.
4. When setting foreign key constraints, you can perform cascade data update operations as follows.
On delete cascade: when the primary table data is deleted, the corresponding sub-table data is also deleted;
On delete set null: when the primary table data is deleted, the corresponding sub-table data is SET to null.
5. constraints can be set when the table is defined, or you can add constraints separately for existing data tables. The ALTER command is used to modify the constraints.
6. When a constraint is temporarily not in use, you can set it to disabled and then re-enable it.