Categories
Sql Server

What are Constraints

What are Constraints:- Constraints are an ANSI-standard method of enforcing data integrity. Constraints ensure valid data values are entered in columns and that the relationships between tables should be maintained.

Integrity Type Constraint type Target Description
Domain DEFAULT Column Specifies the default value for the column when INSERT statement does not provide a value.
CHECK Column Specifies data values that are acceptable in a column. The CHECK constraint is recommended alternative to a rule object.
FOREIGN KEY Table Specifies the data values that are acceptable to update, based on values in a column in another table.
NULL Column Specifies whether the value of a column can be NULL.
Entity PRIMARY KEY Table Identifies each row uniquely. Null values are not allowed.
UNIQUE Column Prevents duplication of alternative (nonprimary) keys and ensures that an index is created to enhance performance. A single null value is allowed.
Referential FOREIGN KEY Table Defines a column or combination of columns with values that match the primary key of the same or another table.
CHECK Column Specifies the data values that are acceptable in a column based on values in other columns in the same table.

4 replies on “What are Constraints”

Comments are closed.