1. PRIMARY KEY constraint (PRIMARY key)
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 table can have only one primary key, either a primary key for a single field or a federated primary key for multiple fields, depending on the actual scenario.
2. FOREIGN KEY constraints
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.
Note that when there is a foreign key constraint, deleting the data is cumbersome, you need to first delete the table data of the associated foreign key, and then delete the table.
3. Non-null constraints
A non-null constraint (NOT NULL), which can be understood by a name, is a non-null constrained column that must not be empty when inserting a value.
4. Default Constraints
The default value constraint, default, specifies that when a column with a default constraint is blank, the Insert data is empty, and the defaults are used.
5. Unique constraints
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.
Add a point of knowledge:
Data type of SQL
Http://www.w3school.com.cn/sql/sql_datatypes.asp
Http://www.cnblogs.com/ray-wong/p/3792515.html
MySQL Basic Learning-sql constraints