What are the different types of Constraints in SQL Server?

Introduction:

In this article i will explain what is Constraint. And how many Constraints available in SQL Server.

Description:

In previous articles i explained Temporary Table and other SQL Server topics. Now i will explain what is Constraint. And how many Constraints available in SQL Server.

Constraint:

A Constarint is condition which is imposed on the data. Constraints define rules regarding the values allowed in columns and are the standard mechanism for enforcing integrity. 

SQL Server supports the following classes of constraints:

  1. NOT NULL
  2. CHECK
  3. UNIQUE
  4. PRIMARY KEY
  5. FOREIGN KEY
  6. DEFAULT

Note: 

The query optimizer also uses constraint definitions to build high-performance query execution plans.