Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
Consistency, in the context of databases, states that data cannot be written that would violate the database’s own rules for valid data. If a certain transaction occurs that attempts to introduce inconsistent data, the entire transaction is rolled back and an error returned to the user.
A simple rule of consistency may state that the ‘Gender’ column of a database may only have the values ‘Male’ , ‘Female’ or ‘Unknown’. If a user attempts to enter something else, say ‘Hermaphrodite’ then a database consistency rule kicks in and disallows the entry of such a value.
Consistency rules can get quite elaborate, for example a bank account number must follow a specific pattern- it must begin with a ‘C’ for checking account or ‘S’ for savings account, then followed by 14 digits that are picked from the date and time, in the format YYYYMMDDHHMISS.
Database consistency does not only occur at the single-record level. In our bank example above, another consistency rule may state that the ‘Customer Name’ field cannot be empty when creating a customer.
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.