Constraints are nothing but the rules on the data. What data is valid and what is invalid can be defined using constraints. So, that integrity of data can be maintained.
Following are the widely used constraints:
- Primary Key : which uniquely identifies the data . If this constraint has been specified for certain column then we can't enter duplicate data in that column
- Check : Such as
NOT NULL
. Here we can specify what data we can enter for that particular column and what is not expected for that column.
- Foreign key : Foreign key references to the row of other table. So that data referred in one table from another table is always available for the referencing table.