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 can be enforced through indexes, UNIQUE constraints and PRIMARY KEY constraints.
Domain integrity validates data for a column of the table.
It can be enforced using:
Foreign key constraints,
FOREIGN KEY and CHECK constraints are used to enforce Referential 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.