The integrity of the data is achieved through various constraints;
PRIMARY KEY constraint: (a table can have only one PRIMARY KEY constraint)
The primary key is each row that identifies the table, which is a constraint applied to the column.
The primary key comes with non-nullability and uniqueness.
It is defined in the following way:
CREATE TABLE Students (
ID INT PRIMARY KEY);
Unique constraint:
It means that all values for a given column must be unique, and the value of each row in the table must be unique.
The unique constraint is consistent with the functionality of the primary KEY constraint in addition to allowing null values and allowing multiple unique constraints in a table.
Keyword: UNIQUE
For example, the value of the Tel column can only be achieved with the following statement:
CREATE TABLE Students (
TEL VARCHAR (a) UNIQUE);
CHECK constraints:
When you ask for input data in a certain range of time can be used to check the constraints;
For example, the age required for input is between 15-20 years old and can be achieved with the following sentences;
CREATE TABLE Students (
Age Int. CHECK (age between and 20));