Enforcing data integrity ensures the quality of the data in the database. Two important steps when planning tables are identifying valid values for a column and deciding how to enforce the integrity of the data in the column. Data integrity falls into four categories, and is enforced in various ways.
Integrity type | How enforced |
---|---|
Entity integrity | PRIMARY KEY constraint UNIQUE constraint IDENTITY property |
Domain integrity | Domain DEFAULT definition FOREIGN KEY constraint CHECK constraint Nullability |
Referential integrity | Domain DEFAULT definition FOREIGN KEY constraint CHECK constraint Nullability |
User-defined integrity | All column- and table-level constraints in CREATE TABLE Stored procedures Triggers |