In MySQL, there are usually these kinds of constraints:
DROP DATABASE mysql_shiyan;删除数据库
The primary key (PRIMARY key) is used to constrain a row in the table, and as a unique identifier for the row, the primary key is the key to the exact row in one table. The primary key cannot be duplicated and cannot be empty.
A unique constraint is simple, which specifies that the value of a column specified in a table must not have duplicate values, that is, each value in this column is unique.
The foreign key (FOREIGN key) ensures both data integrity and the relationship between tables.
A table can have multiple foreign keys, and each foreign key must REFERENCES (reference) The primary key of another table, the column that is constrained by the foreign key, and the value must have a corresponding value in the column it references.
Linux-mysql database Constraints 3