Constraints in SQL Server - SQL Server: Tips and Tricks - 2 (2017)

SQL Server: Tips and Tricks - 2 (2017)

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.

1. Not Null Constraint

2. Check Constraint

3. Default Constraint

4. Unique Constraints

5. Primary Key Constraint

6. Foreign Key Constraint