2020-11-20

Six major constraints in the database

Six major constraints
1. NOT NOULL: Not empty, used to ensure that the value of the field cannot be empty, such as name, student ID, etc.
2. DEFAULT: Default, used to ensure that the word stock has a default value
such as gender.
3. PRIMARY KEY: Primary key, used to ensure that the value of the field is unique and non-empty, such as student ID, employee ID, etc.
4. UNIQUE: unique, used to ensure that the value of the field is unique, and it can be empty, such as a seat number.
5. CHECK: Check constraints, such as age and gender.
6. FOREIGN KEY: foreign key, used to limit the relationship between the two tables, used to ensure that the value of the field must come from the associated column of the main table, add a foreign key constraint from the table, used to reference a column in the main table Value. For example, the professional number of the student table, the department number of the employee table, and the type of work number of the employee table.
Learn from Bilibili’s Riemann’s conjecture as your own notes

Guess you like

Origin blog.csdn.net/qq_51592187/article/details/109864636