Constaint allows us to set specific rules for data in a table. For example; to make sure that the data in a column is between certain values.
A constraint can affect only a column, but it can also affect the entire table. We can define Constraints in the stage of creating the table or after creating the table.
Here are the most common types of constraint used in SQL Server:
NOT NULL Constraint | “NOT NULL Constraint in SQL Server(TSQL)“ |
DEFAULT Constraint | “How To Create Default Constraint On SQL Server“ |
UNIQUE Constraint | “What is Unique Constraint“ |
Primary Key and Foreign Key | “What is Primary Key and Foreign Key“ |
CHECK Constraint | “How To Create CHECK CONSTRAINT“ |
INDEX | “Index Concept and Performance Effect on SQL Server“ |