Constraints are statements used to establish the rules for all records in the table.
If any action violates a constraint, that action will be aborted. Constraints are defined while creating the database itself with CREATE TABLE statement, or after the table is created, by using ALTER TABLE statement.
The five major constraints used in SQL are:
NOT NULL: indicates that the column is required to have some value; it cannot be left null
UNIQUE: ensures that each row and column has unique value; no value is being repeated in any other row or column
PRIMARY KEY: used in association with NOT NULL and UNIQUE constraints to identify a particular unique record
FOREIGN KEY: used to ensure the referential integrity of data in the table and also matches the value in one table with another using PRIMARY KEY
CHECK: used to ensure the value in columns obeys specified conditions