Вы находитесь на странице: 1из 6

Database II

Database Integrity

1
Muhammad Asghar Khan
Database Integrity (1/5)

 A database must be designed to store the correct data in the


correct way without that data becoming damaged or
corrupted

 We can think of data integrity in different aspects as

 Physical Aspect of Data Integrity


• Also called Relational Integrity or Integrity Constraints

• Can be implemented using DBMS features such as domains and data


types

• Most relational DBMS products provide the following types of


constraints:
2
Database Integrity (2/5)
• Primary Key constraints (Entity Integrity)
• According to entity integrity in a base relation, no attribute of a
primary key can be null

• Referential constraints (Referential Integrity)


• The foreign key value must match a candidate key value of some
tuple in its home relation or foreign key value must be null

• Unique constraints
• An attribute value can have null values but no duplicates are allowed

• Check constraints
• Applies a condition to a column value where that value must evaluate
to TRUE
• A condition can be of the form columnA = 5

3
Database Integrity (3/5)
 Semantic Aspect of Data Integrity
• It relates to meaning of the data

• It is more difficult to control and less easily defined

• An example of semantic integrity is the quality of the data in the


database

• Procedures and practices need to be in place to ensure data quality.

• For example, a customer database that contains a wrong address or


phone number in 25% of the customer records is an example of a
database with poor quality

• Data quality is encouraged through proper application code, sound


business practices, and specific data policies
4
Database Integrity (4/5)

 DBMS Internal Aspect of Data Integrity


• The DBMS relies on internal structures and code to
maintain links, pointers, and identifiers

• Internal DBMS integrity is essential in the following areas:

• Index consistency
• An index is really nothing but an ordered list of pointers to data in
database tables

• Pointer consistency
• Sometimes large multimedia objects are not stored in the same
physical files as other data.
• Therefore, the DBMS requires pointer structures to keep the
multimedia data synchronized to the base table data
5
Database Integrity (5/5)

• Backup consistency
• Some DBMS products occasionally take improper backup copies
that effectively cannot be used for recovery
• It is essential to identify these scenarios and take corrective
actions

Вам также может понравиться