Search code examples
databasetransactionsdatabase-integritydata-consistency

Are there any difference between data integrity and data consistency?


I'm a little confused about data consistency and data integrity. From Oracle Database Concepts:

data integrity
--------------
Business rules that dictate the standards for acceptable data. These rules
are applied to a database by using integrity constraints and triggers to
prevent invalid data entry.

From Wikipedia

Consistency
-----------
Consistency states that only valid data will be written to the database.

So what's the difference between data consistency and data integrity?

Thanks in advance.


Solution

  • They are not only different, they are orthogonal.

    Inconsistency:
    A DB that reported employee Joe Shmoe's department as Sales but that didn't list Joe Shmoe among the employees in the Sales department would be inconsistent.
    It's a logical property of the DB, independent of the actual data.

    Integrity:
    A DB that reported jOe SaleS to be a member of the Shmoe department would lack integrity.
    jOe SaleS isn't a valid employee name and Shmoe isn't a valid department.
    That's not logically invalid, but it is invalid relative to the rules that govern data content.