How integrity is enforced depends on the type of integrity being enforced. The types of data integrity are Domain, Entity, and Referential.
Domain integrity refers to restricting the values that are valid for a column and the allowance or absence of nulls. Domain integrity is enforced by the datatype, restriction of the use of nulls, and validity checking such as is done with check constraints.
Entity integrity requires that all rows in a table be unique. This is enforced with a unique identifier known as the primary key.
Referential integrity maintains the dependent values between tables. Referential integrity is enforced with a primary key/foreign key relationship. Referential integrity ensures data in one table maintains its relationship with data in another table, that all foreign key, or child, records in one table relate to the valid primary key, or parent, records in another table.