Normalization:
In DBMS, database normalization is a process of making the database consistent by-
● Reducing the redundancies
● Ensuring the integrity of data through lossless decomposition
Normal Forms:
● First Normal Form (1NF) - A given relation is called in First Normal Form (1NF) if each cell
of the table contains only an atomic value i.e. if the attribute of every tuple is either
single valued or a null value.
● Second Normal Form (2NF) - A given relation is called in Second Normal Form (2NF) if
and only if
o Relation already exists in 1NF.
o No partial dependency exists in the relation.
A → B is called a partial dependency if and only if- A is a subset of some
candidate key and B is a non-prime attribute.
● Third Normal Form (3NF) - A given relation is called in Third Normal Form (3NF) if and
only if
o Relation already exists in 2NF.
o No transitive dependency exists for non-prime attributes.
A → B is called a transitive dependency if and only if- A is not a super key and B
is a non-prime attribute.
● Boyce-Codd Normal Form - A given relation is called in BCNF if and only if
o Relation already exists in 3NF.
o For each non-trivial functional dependency ‘A → B’, A is a super key of the
relation.
Transaction:
Transaction is a single logical unit of work formed by a set of operations.
Operations in Transaction:
● Read Operation - Read(A) instruction will read the value of ‘A’ from the database and
will store it in the buffer in main memory.
● Write Operation – Write(A) will write the updated value of ‘A’ from the buffer to the
database.
Transaction States:
● Active State –
o This is the first state in the life cycle of a transaction.
o A transaction is called in an active state as long as its instructions are getting
executed.
o All the changes made by the transaction now are stored in the buffer in main
memory.
● Partially Committed State –
o After the last instruction of the transaction has been executed, it enters into a
partially committed state.
o After entering this state, the transaction is considered to be partially committed.
o It is not considered fully committed because all the changes made by the
transaction are still stored in the buffer in main memory.
● Committed State –
o After all the changes made by the transaction have been successfully stored into
the database, it enters into a committed state.
o Now, the transaction is considered to be fully committed.
● Failed State –
o When a transaction is getting executed in the active state or partially committed
state and some failure occurs due to which it becomes impossible to continue
the execution, it enters into a failed state.
● Aborted State –
o After the transaction has failed and entered into a failed state, all the changes
made by it have to be undone.
o To undo the changes made by the transaction, it becomes necessary to roll back
the transaction.
o After the transaction has rolled back completely, it enters into an aborted state.
● Terminated State –
o This is the last state in the life cycle of a transaction.
o After entering the committed state or aborted state, the transaction finally
enters into a terminated state where its life cycle finally comes to an end.