0% found this document useful (0 votes)
10 views4 pages

Dbms

Souben
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

Dbms

Souben
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

fthatiis Normalization?

Normaliizzatatiioonn is used to organizing the data in


Normal
is the
procesS of
eliminate undesirable minimize thelikeredundancy fromthea relation database.or
Normal izatioform
The rormal n divides charact eristics
the larger table intoInsertion, Update. and set of
Deletion relations. It is also used to
Why do we need
is used to
reduce redundancy from thelinks them using Anomalíes.
smaller and
The main reason for Normalization? database table. relationships.
anomalies normalizing the relations is removing these
leads to data
qrows. redundancy and can anomalies.
and other Failure eliminate
datalbaseNormalization
cause dala to
structure consists of a series of quicdelines thatintearity
helps to guide youproblems as the
database
VINF Arelation is in 1NF if it in creating a good
2NF A relation will be
contains an
atomic value.
in 2NF if it is in
dependent
on the 1NF and all
primary key. non-key attributes are fully
3NF functional
Aelation will be in 3NFif it is in 2NF and no
Strong Entity Type: It is an entity that transition dependency exists.
The entity has its own existence and
Weak Entityrelationship diagram is
a strong entity type independent.
Type: It is an entityrepresents
that does not have its own with the help ofa single
for its existence. rectangle.
existence and relies on a strong entity

Narr

Customor has

Actcress
WGak Entity Type
Lcocuhon

Entity Rolationship Diagrnnn b otwcen Strong Entity TYpe &


WeakEntity Type
Transaction Management in DBMS
Atransaction is a set of logically related operations. For example, you are transferring money
from your bank account to your friend's account. the set of operations would be like this:

SimpBe Transaction Example


L. Rcad your account balance
2. Deduct the amount from your balance
3. Write the remaining balance to your account
4. Read your fricnd's account balance
5. Addthc amount to his account balance
6. Write the new updatcd balance to his account
Thiswhole set of operations can be called a transaction. Although I have shown you read, write
andupdate operations in the above exanple but the transaction can have operations like read,
write, insert. update, delete.

In DBMS, we write the above 6 steps transaction like this:


Lets say your account is A and your friend's account is B. youare transferring 10000from A
to B. the steps of the transaction are:
I. R(A);
2. A =A - 10000;
3. W(A);
4. R(B):
5. B= B + 10000;
6. W(B); refers to the write operation.
In the above transaction R rcfers to the Read operation and W

Transaciion failure in between the operations

Now that we understand what transaction. we should understand what are the protblens
associatcd with it.

transaction is that the transaction can fail betore


The main problen that can happen during a to power failure, system crash
finishing the all the operations in the set. This can happen due that
database in an inconsistent state. Assume
ete. This is a serious problem that can leave
above) then the amount would be
transaction fail after third operation (see the example
deducted from your account but your friend will not receive it.

To solve this problem, we have the following two operations


then commit those
Commit: If all the operations in a transaction are completed successfully
changes to the databasc permanently.

changes done by previous


tRolback: If any of the operation fails thcn rollback all the
operations.
Even though these operations can help us avoiding several issues that may arise during
transaction but they are not sufficient when two transactions are running concurrently. To
handle those problems we need to understand database ACID properties.

ACID Properties in DBMS


Atransaction is a single logical unit of work which accesses and possibly modifies the
contents of a database. Transactions access data using rcad and write operations.
In order to maintain consistency in a database, before and after the transaction, certain
propertics are followed. These are called ACID properties.

ACID Properties in DBMS


The entire transaction takes place at once
A= Atomicity or doesnt háppen at al.

The database must be consistent before


-C= Consistency andafter the transaction.

ACID
Muitiple Transaçtions occur independently
+=Isolation without interference.

The changes of a successful transaction


D- Durability
ocCårs cvCn if the system failure acaursDG

Atomicity
By this, we mean that either the entire transaction takes place at once or doesn't happen at all.
There is no midway i.e. transactions do not occur partially/ Each transaction is considered as
one unit and either runs to completion or is not executed at all, It involves the following two
operations.
-Abort: If a transaction aborts, changes made to database are not visible.
Commit: If transaction commits, changes
Atomicity is also known as the 'All or nothing rule.
made are
evisible.

Consider the following transaction Tconsisting of Tl and T2: Transfer of 100 from
account X to account Y.
Before: %:500 Y: 200
Transaction T

Read (X) Read (V)


X:=X-100 Y:=Y+ 190
Write (Xj write (Y)
After: X:400 Y:300
1f the transaction fails after completion ofTI but before
afler write(X) but before write(Y), then anmount has been deducted completion of T2.( say,
from X but not added
to Y. This results in an inconsistent database state. Therefore, the
transaction imust be executed
in entirety in order to ensure correctness of database statc.

Consistency
This means that integrity constraints must be maintained so that the database is consistent
beforc and after the transaction. It refers to the correctness of a database. Referring to the
example above, The total amount before and after the transaction must be maintained.
Total before T occurs =500 + 200 = 700.
Total after T occurs = 400 + 300 = 700.

Therefore, database is consistent. Inconsistency occurs in case T1 completes but T2 fails. As


a result T is incomplete.

Jsolation
Thisproperty ensures that multiple transactions can occur concurrently without leading to the
inconsistency of database state. Transactions occur independently without interference.
Changes occurring in a particular transaction will not be visible to any other transaction until
that particular change in that transaction is written to memory or has been commited. This
property ensures that the execution of transactions concurrently will result in a state that is
equivalcnt to a state achieved these were executed serially in Some order.
Let X= 500. Y = 500.

Consider two transactions T and T".

Read (X; Read (X:


X;= X*i00 Read {Y)
rite (X) Z: =%+ y
Read (Y) write (Z)
Y:=Y-50
Write

Suppose T has been executed tillRead (Y) and then T'' starts. As a result , interleaving of
operations takes place due to which T'' reads correct value of X but incorrect value of Y and
sum computed by
T': (X+Y = 50, 000+500=50, 500)
thås not consistent with the Sum at end of transaction:
T: (X+Y =50, 000 + 450 = 50, 450).

This results in database inconsistency, due to a loss of 50units,. Hence, transactions must take
place
memory
in isolation and changes should be visible only after they have been made to the main

Hurability:
This property ensures that once the transaction has completed execution, the updates and
modifications to the database are stored in and written to disk and they persist even if asystem

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy