Professional Documents
Culture Documents
Domain constraints
o Domain constraints can be defined as the definition of a valid set of values for an
attribute.
o The data type of domain includes string, character, integer, time, date, currency, etc.
The value of the attribute must be available in the corresponding domain.
Example:
2. Entity integrity constraints
o The entity integrity constraint states that primary key value can't be null.
o This is because the primary key value is used to identify individual rows in relation
and if the primary key has a null value, then we can't identify those rows.
o A table can contain a null value other than the primary key field.
Example:
There are four primary types of data integrity: entity, domain, referential and user-defined.
Entity integrity applies at the row level; domain integrity applies at the column level, and referential
integrity applies at the table level.
1. Entity Integrity in database ensures a table does not have any duplicate rows and is uniquely
identified.
2. Domain Integrity requires that a set of data values fall within a specific range (domain) in order to
be valid. In other words, domain integrity defines the permissible entries for a given column by
restricting the data type, format, or range of possible values.
3. Referential Integrity is concerned with keeping the relationships between tables synchronized.
4. User-defined Integrity refers to specific business rules not covered by the other integrity
categories. It is typically implemented through triggers and stored procedures. Data integrity is
enforced by features such as check constraints, triggers, views, stored procedures, user-defined
functions, and/or referential constraints.