ACID properties of databases

Description of the properties
ACID stands for
• • • •

Atomicity Consistency Isolation Durablity

It states that database modifications must follow an “all or nothing” rule. Each transaction is said to be “atomic.” If one part of the transaction fails, the entire transaction fails. It is critical that the database management system maintain the atomic nature of transactions in spite of any DBMS, operating system or hardware failure.

It states that only valid data will be written to the database. If, for some reason, a transaction is executed that violates the database’s consistency rules, the entire transaction will be rolled back and the database will be restored to a state consistent with those rules. On the other hand, if a transaction successfully executes, it will take the database from one state that is consistent with the rules to another state that is also consistent with the rules.

It requires that multiple transactions occurring at the same time not impact each other’s execution or One transaction does not interfere with another. The 'executor' of a transaction has the feeling that he has the entire database for himeself.

A commited(Saved) transaction will not be lost. Durability is ensured through the use of database backups and transaction logs that facilitate the restoration of committed transactions in spite of any subsequent software or hardware failures.

Normalization: Database normalization can essentially be defined as the practice of optimizing table structures. Normalization helps us to elimate redundant data and to store the data we have in a manner that makes sense. Atomicity also must be maintained in tables via normalization. Normalization helps us to create atomic tables by removing redundant data within rows of a table, thus creating atomic tables.

Denormalized Data Let’s take a look at some denormalized data. I’m going to use the simplest example that comes to mind, and that is a auto repair shop that specializes in domestic automobiles (domestic to the US, that is). Our table lists automobile manufactuers and the makes of automobiles they manufactuer that the shop services. Fig. 1 Manufactuer Ford GM Chrysler

Make 1 Mercury Chevrolet Dodge

Make 2 Lincoln Pontiac

Make 3 Ford Saturn, Buick

Normal Forms: First Normal Form (1NF) We want to take fig. 1 and normalize it a bit. Before we can do that, we need to know what the rules of 1NF are. There are 2 rules to 1NF.
• •

Remove duplicate columns. Each column by row position must have a unique value.

As you can see, 1NF is already enforcing the atomic nature of a table. So first we need to remove duplicate columns from the table, at the same time creating column by row positions that have unique values, which means we also have to seperate Saturn, Buick into individual values. Fig. 2 Manufactuer Ford Ford Ford GM GM GM GM Chrysler

Make Mercury Lincoln Ford Chevrolet Pontiac Saturn Buick Dodge

Second Normal Form (2NF) For each level of normal form, the next level must adhere to the rules of the previous level, in addition to adding its own rules. This means in order to create a data structure that meets the requirements of 2NF, we must first meet the requirements of 1NF. We have already discussed the rules for 1NF, so let’s look at the rules required to meet 2NF.
• •

Remove duplicate data in a single column and place the data in seperate tables. Create relationships between the sets of data.

Manufactuer Table ManufactuerId 1 2

Manufactuer Ford GM

3 Make table Manufactuer 1 1 1 2 2 2 2 3


Make Mercury Lincoln Ford Chevrolet Pontiac Saturn Buick Dodge

Fig. 4

Third Normal Form (3NF) Again, in order to meet the rules of 3NF, we must first meet the rules of 1NF and 2NF. In addition to meeting these requirements, 3NF introduces 1 other rule:

All columns that are not dependent on the primary key must be removed.

Sounds simple enough. First, lets take our Make table from Fig. 3 and add a column to it that shows how much the auto repair shop charges per hour for each different make, and also a column that shows if the shop works on cars or trucks for each particular make. Make table Manufactuer 1 1 1 2

Make Mercury Lincoln Ford Chevrolet

Charge $60 $60 $75 $55

Style Cars Cars Trucks Both

2 2 2 3

Pontiac Saturn Buick Dodge

$60 $60 $60 $75

Cars Cars Cars Trucks

The Final Data( In 3rd normal Form) Manufactuer Table ManufactuerId (PK) 1 2 3 Make table MakeId (PK) 1 2 3 4 5 6 7 8 Style Table StyleId (PK) 1 2 3

Manufactuer Ford GM Chrysler

Manufactuer (FK) 1 1 1 2 2 2 2 3

Make Mercury Lincoln Ford Chevrolet Pontiac Saturn Buick Dodge

Style (FK) 1 1 2 3 1 1 1 2

Style Cars Trucks Both

Charge $60 $75 $55

Sign up to vote on this title
UsefulNot useful