Database Integrity

A database is a model of part of the real world. It should be consistent and its contents should match the section of reality it is modeling. Data integrity is one of the most important aspects to be taken into consideration when programming application software. You distinguish between the following:

Semantic integrity

Semantic integrity refers to the consistency and completeness of the data. In a flight reservation system, for example, the field 'Occupied seats' for each flight must always contain a value which is less than or equal to the contents of the field 'Maximum number of seats' - to avoid overbooked flights. If this is not the case, the data is inconsistent. In addition, each new booking in the flight reservations table must increase the contents of the field 'Occupied seats' for the booked flight in the flights table. Together, both these operations form a unit and, if only one is executed, the database becomes incomplete.

In many database systems, you can check semantic integrity conditions with constraints or triggers. However, since these methods are not used in the R/3 System due to their lack of standardization, programmers must verify the semantic integrity of the database themselves.

As the flight reservation example shows, the data is usually in an inconsistent or incomplete state in the course of a transaction. For this reason, programmers need to be able to confirm the end of the transaction and thus the restoration of the semantic integrity of the data. This is achieved through the database commit.

Relational integrity

Relational integrity refers to the observation of the integrity rules governing the relational model. Since data modeling in the R/3 System is based on the relational data model, you must keep to these rules. They include:

Operational integrity

Operational integrity guarantees protection for the dataset against inconsistencies caused by several users attempting to gain access at the same time. The necessity for this is demonstrated by the next example, where clerks S1 and S2 want to make a booking in the flight reservation system at the same time.

Since both clerks find the same value in the field 'Occupied seats', the flight can be overbooked.

Database systems guarantee operational integrity automatically by enqueueing competing accesses. This process is achieved through database locking which can be demonstrated by the following variant of the above example: