Sei sulla pagina 1di 3

DATA INTEGRITY

Data integrity is a term used to refer to the accuracy and reliability of data. Data must be complete, with no variations or compromises from the original, to be considered reliable and accurate. Compromises to data integrity can happen in a number of ways. In industries where data is handled, identifying and addressing potential sources of damage to data is an important aspect of data security. Problems with data integrity can start with a human source. People entering records may make mistakes, leading to variations between the original data and the data stored in a system. Likewise, people can make mistakes while transferring or copying data electronically, causing a disparity between different versions of a file or references to a file. In order for data integrity to be maintained, there need to be no changes or alterations to the data. As data is entered, stored, accessed, moved, and updated, weak points in a system can compromise the data. Glitches in a computer may lead to partial overwrites of data or other data errors. Viruses can be created to attack data integrity, some working quietly to damage data without betraying their presence. Interruptions in various operations can lead to problems, as can mechanical damage like exposure to magnets or physical damage caused by power outages and other events. Data that has integrity is identically maintained during any operation (such as transfer, storage or retrieval). Put simply in business terms, data integrity is the assurance that data is consistent, certified and can be reconciled. In terms of a database data integrity refers to the process of ensuring that a database remains an accurate reflection of the universe of discourse it is modeling or representing. In other words there is a close correspondence between the facts stored in the database and the real world it models. Data integrity is normally enforced in a database system by a series of integrity constraints or rules. Three types of integrity constraints are an inherent part of the relational data model: entity integrity, referential integrity and domain integrity
1. Entity integrity

Entity integrity concerns the concept of a primary key Entity integrity is an integrity rule which states that every table must have a primary key and that the column or columns chosen to be the primary key should be unique and not null. Entity (or table) integrity requires that all rows in a table have a unique identifier, known as the primary key value. Whether the primary key value can be changed, or whether the whole row can be deleted, depends on the level of integrity required between the primary key and any other tables. Entity integrity is one of the three inherent integrity rules Entity integrity is an integrity rule which states that every table must have a primary key and that the column or columns chosen to be the primary key should be unique and not null. A direct consequence of this integrity rule is that duplicate rows are forbidden in a table. If each value of a primary key must be unique no duplicate rows can logically appear in a table. The NOT NULL characteristic of a primary key ensures that its value can be used to identify all rows in a table. Within relational databases using SQL, entity integrity is enforced by adding a primary key clause to a schema definition. The system enforces Entity Integrity by not allowing

Jameel Channa

operations (INSERT, UPDATE) to produce an invalid primary key. Any operation that is likely to create a duplicate primary key or one containing nulls is rejected. The Entity Integrity ensures that the data that you store remains in the proper format as well as comprehensible.

2. Referential integrity Referential integrity is a property of data which, when satisfied, requires every value of one attribute (column) of a relation (table) to exist as a value of another attribute in a different (or the same) relation (table). For referential integrity to hold in a relational database, any field in a table that is declared a foreign key can contain only values from a parent table's primary key or a candidate key. For instance, deleting a record that contains a value referred to by a foreign key in another table would break referential integrity. Some relational database management systems (RDBMS) can enforce referential integrity, normally either by deleting the foreign key rows as well to maintain integrity, or by returning an error and not performing the delete. Which method is used may be determined by a referential integrity constraint defined in a data dictionary. Referential integrity concerns the concept of a foreign key. The referential integrity rule states that any foreign key value can only be in one of two states. The usual state of affairs is that the foreign key value refers to a primary key value of some table in the database. Occasionally, and this will depend on the rules of the business, a foreign key value can be null. In this case we are explicitly saying that either there is no relationship between the objects represented in the database or that this relationship is unknown.
Benefits of Referential Integrity

Improved data quality

An obvious benefit is the boost to the quality of data that is stored in a database. There can still be errors, but at least data references are genuine and intact.
Faster development

Referential integrity is declared. This is much more productive (one or two orders of magnitude) than writing custom programming code.
Fewer bugs

The declarations of referential integrity are more concise than the equivalent programming code. In essence, such declarations reuse the tried and tested general-purpose code in a database engine, rather than redeveloping the same logic on a case-by-case basis.
Consistency across applications

Referential integrity ensures the quality of data references across the multiple application programs that may access a database. You will note that the definitions from the Web are expressed in terms of relational databases. However, the principle of referential integrity applies more broadly. Referential integrity applies to both relational and OO databases, as well as programming languages and modeling. Jameel Channa 2

3. Domain Level Integrity A domain defines the possible values of an attribute. Domain Integrity rules govern these values. In a database system, the domain integritys defined by: The data type and the length The NULL value acceptance The allowable values, through techniques like constraints or rules The default value For example, if you define the attribute of Age, of an Employee entity, is an integer, the value of every instance of that attribute must always be numeric and an integer. If you also define that this attribute must always be positive, a negative value is forbidden. The value of this attribute being mandatory indicates that the attribute can be NULL. All of these characteristics form the domain integrity of this attribute. This type of data integrity warrants the following: the identity and purpose of a field is clear and all of the tables in which it appears are properly identified; field definitions are consistent throughout the database; the values of a field are consistent and valid; and the types of modifications, comparisons and operators that can be applied to the values in the field are clearly identified.

Jameel Channa

Potrebbero piacerti anche