What is Constraint? And types of constraints 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.