What are different Types of Constraints Available in SQL Server - SQL Server / T-SQL Tutorial Part 50

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.

  1. Not Null Constraint
  2. Check Constraint
  3. Default Constraint
  4. Unique Constraint
  5. Primary Key Constraint
  6. Foreign Key Constraint

1 comment:

  1. I Have one doubt different beetween primary key and unique key