What is Data Integrity in SQL:
Enforcing data integrity in RDBMS ensures the quality of the data in the database. For example, if an employee is entered with an EmployeeId value of 111, the database should not allow another employee to have an ID with the same value.
The following are the categories of the data integrity exist with each RDBMS:
Entity Integrity In SQL:
Entity Integrity ensures There are no duplicate rows in a table. This can be achieved using constraints like UNIQUE, or creating IDENTITY COLUMN or adding PRIMARY KEY to the column.
Domain Integrity In SQL:
The Domain Integrity Enforces valid entries for a given column by restricting the type using DATA TYPES, the format by using CHECK constraints and rules or the range of values by using CHECK Constrains, giving DEFAULT values , Adding foreign key constrains or adding NOT NULL definitions to the columns.
Referential integrity In SQL:
By enforcing Referential integrity, Rows cannot be deleted, which are used by other records. In RDBMS referential integrity is the relationships between foreign keys and primary keys.
User-Defined Integrity In SQL:
The User-Defined Integrity rules Enforces some specific business rules that do not fall into entity, domain or referential integrity.
Enforcing data integrity in RDBMS ensures the quality of the data in the database. For example, if an employee is entered with an EmployeeId value of 111, the database should not allow another employee to have an ID with the same value.
The following are the categories of the data integrity exist with each RDBMS:
- Entity Integrity
- Domain Integrity
- Referential integrity
- User-Defined Integrity
Entity Integrity In SQL:
Entity Integrity ensures There are no duplicate rows in a table. This can be achieved using constraints like UNIQUE, or creating IDENTITY COLUMN or adding PRIMARY KEY to the column.
Domain Integrity In SQL:
The Domain Integrity Enforces valid entries for a given column by restricting the type using DATA TYPES, the format by using CHECK constraints and rules or the range of values by using CHECK Constrains, giving DEFAULT values , Adding foreign key constrains or adding NOT NULL definitions to the columns.
Referential integrity In SQL:
By enforcing Referential integrity, Rows cannot be deleted, which are used by other records. In RDBMS referential integrity is the relationships between foreign keys and primary keys.
User-Defined Integrity In SQL:
The User-Defined Integrity rules Enforces some specific business rules that do not fall into entity, domain or referential integrity.
0 comments:
Post a Comment