What are Constraints in SQL Server?
In simple words, Constraints define rules those we implement to avoid insertion of any data that does not follow the rule.
By using the Constraint, we can validate the data and if complies the rule, It will be inserted in table otherwise rolled back.
Constraints are used to maintain Data Integrity. They make sure the data entered follow the rules we have defined.
There are different types of Constraints available in SQL Server.
- Not Null Constraint
- Check Constraint
- Default Constraint
- Unique Constraint
- Primary Key Constraint
- Foreign Key Constraint