I. INTRODUCTION to CONSTRAINT Types
Second, create a data table
Iii. creating PRIMARY KEY constraints and non-null constraints
Iv. Creating a UNIQUE constraint
Select any column, right--index/Key
Click Add to generate Ix_employees*,
Type is set to "unique key",
Then select the columns you want to constrain,
Finally, the index name is modified.
Five, check the constraints
Case One
Case Two
Vi. Default Constraints
Seven, FOREIGN KEY constraints
Viii. Effects of restraint
Department table
Employee table
CHECK constraints
Non-null constraint
Unique constraint
FOREIGN KEY constraints
FOREIGN KEY constraints
Nine, Cascade Delete
When you delete the primary key table data, the foreign key table data associated with it is also deleted.
Delete data from department table Depid to 1
The Employee table foreign key Empdeptid 1 has also been deleted.
SQL Server Designer Implementation constraints