Professional Documents
Culture Documents
Annexure
Declaration:
I declare that this assignment is my individual work. I have not copied from any other
student’s work or from any other source except where due acknowledgment is made
explicitly in the text, nor has been written for me another person.
Student’s signature:
Yogesh Gandhi
Evaluator’s comments:
Marks obtained _____________________ out of
______________________________
Content of home work should start from this page only:
PART-A
Question 1: Can we achieve 2NF without 1NF. Also differentiate 1NF and 2NF
with an example.
Answer: Normalization is the process of efficiently organizing data in a database.
There are two goals of the normalization process: eliminating redundant data and
ensuring data dependencies make sense. Both of these are worthy goals as they reduce
the amount of space a database consumes and ensure that data is logically stored. No
we can’t achieve 2NF without 1NF because when a relation is in 1NF then it is atomic
i.e. only one value is associated with each attribute and the value is not a set of values
then only we are able to identify a primary key and all the non-primary key attribute in
a relation are fully functionally dependent on the primary key.
Table in 1NF
Inventory
Inventory
Supplier
Question 2:- How is the concept of functional dependency associated with the
process of normalization?
Answer:-
Let r be a relation, and let X and Y be arbitrary subsets of the set of attributes of r.
Then we say that Y is a Functional dependent of X in symbols.
XY
If and only if each X value in r has associated with it precisely one y value in r. In
other words, whenever two tuples or r agree on their X value, they also agree on their
Y values.For example the relation shown in figure satisfied the functional
dependency{S#{CITY}because every tuple of the relation with a given S# value also
has the same CITY value.A functional dependency is a many-to-one relationship
between two sets of attributes of a given relvar. Given a relvar R, the functional
dependency AB is said to hold for R if and only if, whenever two tuples of R have
the same value for A, they also have the same value for B
Because
A->CD and F->A
And
also F->CD and F->DE
So
that F->D
Therefore
the relation R2(A,F,D) is a correct decomposition.
And
also F->E so we can make the relation R3(E,F).
Now
the remaining attributes A,B,C and B->C , so there is another relation form
that is R1(A,B,C).
So all
the three decomposition of relation R in R1, R2 and R3 are correct according to
the rule of functio0nal dependency.
PART-B
Question 4: Draw the state diagram showing various states of a transaction. Also
give the working of this diagram.
Active
Failed Aborted
When a transaction starts its execution, it enters the active state. When transaction is
its last statement it moves from active state to partially committed state. On the
successful execution of the transaction, it moves from partially committed state to
committed state. But if some failure occurs in active or partially committed state then
the transaction enters the fail state. A failed transaction then rolled back and it enters
the aborted state.
There are two options for aborted transaction and they are:
1. An aborted transaction can be restarted if it was aborted as a result of some
hardware or software error.
2. An aborted transaction can be killed by the system if it was aborted as a result
of some internal logical error which can be corrected only by rewriting the application
program.
2. view serializability:- Let S and S´ be two schedules with the same set of
transactions.S and S´ are view equivalentif the following three conditions are met:
1. For each data item Q, if transaction Ti reads the initial valueof Q in schedule S,
then transaction Ti must, in schedule S´,also read the initial value of Q.
2. For each data item Q if transaction Ti executes read(Q) inschedule S, and that
value was produced by transaction Tj(if any), then transaction Ti must in schedule S´
also read thevalue of Q that was produced by transaction Tj .
3. For each data item Q, the transaction (if any) that performs the final write(Q)
operation in schedule S must perform thefinal write(Q) operation in schedule S´.
(Example)
1. T3 | T4 | T6
2. read3(Q) | |
3. | write4(Q) |
4. write3(Q) | |
5. | | write6(Q)
This schedule is view serializable. It is view equivalent to the serial schedule <T3,
T4, T6>, since one read(Q) instruction reads the initial value of Q in both
schedules, and T6 performs the final write of Q in both schedules.
Question 6:- Are the ACID properties of a transaction essential to ensure the
integrity of data? Give an example of each property.
Answer:
The ACID properties of a transaction essential to ensure the integrity of data
AtomicityAtomicity. . Either all operations of the transaction are properly reflected in
the database or none arereflected are
Ex:-
1 Read(A);
2 A-50;
3 Write(A);
4 Read(B)
5 B+50;
6 Write(B);
Consistency:-Execution of a transaction in isolation preserves theconsistency of the
database
Ex:
Consistency requirement ––the sum of A and B is unchanged by the execution of the
transaction.
Isolation:-. Although multiple transactions may execute concurrently, each transaction
must be unaware of other concurrently executing transactions. Intermediate
transaction results must be hidden from other concurrently executed transactions
Ex:
Once the user has been notified that the transaction has completed (i.e., the transfer of
the $50 hasthe hastaken place), the updates to the database by the transaction taken
must persist despite failuresmust failures