Q : What is data integrity?
Ans: Data integrity is a database state in which all the data values stored in the database are correct. Enforcing data integrity in database ensures the quality of the data in the database.
Categories of data integrity are:
- Entity Integrity: It defines a row as a unique entity for a particular table. Entity integrity enforces the integrity of the identifier column(s) or the Primary key of a table.
- Domain Integrity: Domain integrity validates the entries for a given table. It can be enforced through;
- NOT NULL Constraint
- UNIQUE KEY Constraint
- PRIMARY KEY Constraint
- FOREIGN KEY Constraint
- CHECK Constraint
- DEFAULT keyword
- Referential Integrity: It preserves the defined relationship between tables when records are entered or deleted. It ensures that key values are consistent across tables.
- User defined Integrity: It allows defining specific business rules that do not fall into any of the other integrity categories. There are business rules specific to an organizational business process. So, these business rules are handled at run time, usually by designing database triggers in PL/SQL.