Pages

Monday 27 May 2013

Explain different constraints to maintain data integrity in SQL Server?

Check constraints:
Check constraints will be useful to limit the range of possible values in a column.
We could create check constraints at two different levels
a) Column-level check constraints are applied only to the column and cannot reference data in another other column
b) Table-level check constraints can reference any column within a table but cannot reference columns in other tables
Default constraints:
Default constraints enable the SQL Server to write default value to a column when user doesn’t specify a value.
Unique constraints:
A unique constraint restricts a column or combination of columns from allowing duplicate values.
Primary key constraints:
Primary key constraints will allow a row to be uniquely identified. This will perform by primary key on the table.
Foreign key constraints:
Foreign keys constraints will ensure that the values that can be entered in a particular column exist in a specified table.

No comments:

Post a Comment