Consistency

Why Trust Techopedia

What Does Consistency Mean?

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.

Advertisements

Techopedia Explains Consistency

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.

Consistency rules are vitally important while creating databases, as they are the embodiment of the business rules for which the database is being created. They also serve another important function: they make the application developers’ work easier- it is usually much easier to define consistency rules at the database level rather than defining them in the application that connects to the database.

Advertisements

Related Terms

Margaret Rouse
Technology Expert
Margaret Rouse
Technology Expert

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.