Entity, Domain, Referential Integrity

Define data, entity, domain and referential integrity.

Data Integrity
Data Integrity validates the data before getting stored in the columns of the table.
SQL Server supports four type of data integrity:

Entity Integrity
Entity Integrity can be enforced through indexes, UNIQUE constraints and PRIMARY KEY constraints.

Domain Integrity
Domain integrity validates data for a column of the table.

It can be enforced using:
Foreign key constraints,
Check constraints,
Default definitions
NOT NULL.


Referential Integrity
FOREIGN KEY and CHECK constraints are used to enforce Referential Integrity.

User-Defined Integrity
It enables you to create business logic which is not possible to develop using system constraints. You can use stored procedure, trigger and functions to create user-defined integrity.

Define data, entity, domain and referential integrity.

- Data: Any raw information that needs to be stored in the database for persistence is termed as data.
- Entity: Entity refers to a real world object that might depict a table in an SQL Server database. Databases are often constructed in the basis of an Entity-relationship diagram.
- Domain: A domain represents typically an organization or an organization might have multiple domains representing different groups under the organization. SQL Server administrators usually run SQL Server service using a domain administrator account. Usually it represents the Windows Active directory domain which decides users of what domain would be able to access the SQL Server instance.
- Referential integrity: An RDBS needs to maintain and have logical relationships between various tables for it to work efficiently. When such relationships exist and are maintained as they should be, it represents referential integrity of the data.
BCP Utility and DTS package
SQL Server BCP Utility and DTS package - In this section, we have tried to discuss about SQL Server importing and exporting utility.
Distributed Query linked server ad hoc computer
SQL Server Distributed Query - In this article, we have defined SQL Server distributed query, linked server and ad hoc computer
Extended and Remote stored procedure
SQL Server Extended and Remote stored procedure - Define temporary and extended stored procedure. You can find answer to this question in this series.
Post your comment
Discussion Board
comment
Nice and impressing information
Thanks continue updating us
ODUNG RONALD 03-16-2020
Your definition of entity integrity is also wrong
Entity integrity is the concept that every row in a table be unique. The only way to enforce entity integrity is with unique indexes or unique constraints that are NOT NULL, which happens to be the definition of a primary key.

Finally, your definition of data integrity is similarly wrong. Data integrity is simply the broad term that defines each of entity integrity, referential integrity, domain integrity, and business integrity.
Geoff 02-3-2017
Your definition of domain integrity is completely wrong
Domain integrity is the idea that every value in a column has a finite set of possible values. For example, a column defined as "INT NOT NULL" can only have a valid 32 bit integer in it, and a column defined as "CHAR(1) NULL" can be NULL or any valid, single character.

Your explanation, that it somehow relates to Active Directory Windows domains sounds like a good guess but is not correct. Domain Integrity is a concept that applies to all relational databases, even those that do not integrate with Active Directory.
Geoff 02-3-2017