Integrity
Overview
- Ensuring that the data in a database is correct
- Guarding against invalid or corrupted data
Entity integrity
- The table must have a primary key
- The primary key for each row in the table must be non-null
- The value of each primary key in the table must be unique
Domain integrity
- Values for a field must be within a valid range
Referential integrity
- For every foreign key in a child table, there should be a corresponding primary key in the parent table
- When a row in the parent table is deleted, the corresponding rows in the child table can either be deleted (the deletion cascades from the parent table to the child table), or the foreign key in the child table can be set to "null"