Vous êtes sur la page 1sur 7

ASSIGNMENT 3………(CSE301)

Submitted by: Submitted to:

Name :Salman Khurshid Miss Shabnam Sharma

Sec. C1802

Roll no. B51

PART-A

Ques 1: Consider the relational scheme of the relation SCHEDULE as shown below.What is the
highest normal form of this relation? What type of data anomalies does this relation have ? Give
an example of the type of data anomalies that this relation may experience.

SCHEDULE (stu_id,class_no,stu_name,stu_major,class_time,building_room,instructor).

Assume the following dependencies.

Stu_id->stu_name

Stu_id->stu_major

Class_no->class_time

Class_no->building_room

Class_no->instructor

Ans 1. This relation SCHEDULE has many anamolies like:

Insert

Update

Delete

This highest normal form of this relation is 2NF.


Ques 2: Consider the following table Normalize it upto 5th Normal Form. Also write about
anomalies that occur in each Normal Form

Ans. 2

Anamoly for 1NF is DELETE

Anamoly for 2NF are insert,update,delete.

Anamoly for 3NF is nothing.

Anamol for 4NF is update.

Ques 3 While normalizing the relation schema , : Decomposing a relation schema can create
more problems than it solves. Justify your answer.

Ans:In normalization , NO decomposes the table into smaller tables then relation schema can
create more problems than it sloves. For example:

There is table of sport’club.

Stu_name Games Fees


Salman Cricket 100$

Ahtesham Boxing 1000$

Amit Cricket 100$

Suresh Tennis 300$

Kamal Tennis 300$

Here the rrelation is:

Stu_name->game

Stu_name->fees

And it’s in 1NF but it create the problem’s because if ahtesham does not want to play game.we
have to delete the entire row and it also another problem that is the boxing never exist if he back
out from the game.

And we have to face some anomalies in this table that is

1: insert anomalies

2: delete anomalies

3:update anomalies

To remove this anomalies we decoposes the table into smaller table’s;

Stu_table

Stu_name Game

Amit Cricket

Suresh Tennis

Kamal Tennis

Ahtesham Boxing

Salman cricket
Game_tables

Game Fees

Cricket 300

Tennis 100

Boxing 10000

Here is the relation are

Stu_name->game

Game->fees .

PART-B

Question 4: What is the benefit of shadow copy technique for atomicity

In the shadow-copy scheme, a transaction that wants to update the database first creates a
complete copy of the database. All updates are done on the new database copy, leaving the
original copy. If at any point the transaction has to be aborted, the system merely deletes the new
copy. The old copy of the database has not been affected. If the transaction completes, it is
committed as follows. First, the operating system is asked to make sure that all pages of the new
copy of the database have been written out to disk. After the operating system has written all the
pages to disk, the database system updates the pointer db-pointer to point to the new copy of the
database; the new copy then becomes the current copy of the database. The old copy of the
database is then deleted.

Question 5: Make a comparison between

a)-conflict and view serializability with an example.

Ans5-: Serializibility is the concept which helps in understanding the non serial schedule which
is causing problems and which has same results as that of the transactions which are part of the
schedule.

Conflict Serializibilty-: A schedule is said to be conflict serializible if it is conflict equivalent to


a serial schedule consider the following example in the schedule S1 the write(a) operation of T1
conflicts with the read(a) operation of T2 but the read operation of T1 doesn’t conflict with the
Write(a) operation of T2 because former both the operation with the same data A and one of
them is write operation and in later case the two operations operating on on different data items.
So if we swap the order of non conflicting operations i.e read(b) of transaction T1 with write(a)
of transaction T2 , we get a new schedule S2. S1 and S3 are conflict equivalent as schedule S1
can be transferred into Schedule S3 By series of swaps to schedule S1.

S1 S2 S3

T1 T2 T1 T2 T1 T2

Read(a) Read(a) Read(a)

Write(a) Write(a) Write(a)

Read(a) Read(a) Read(b)


Read(b)
Write(a) Write(b)
Write(a)
Read(b) Read(a)
Write(b)
Write(b) Write(a)
Read(b)
Read(b) Read(b)
Write(b)
Write(b) Write(b)

View Serializibility-: A schedule is said to be view serializible if it is view equivalent to serial


schedule. Consider the following example-:

S1 S2 S3

T1 T2 T1 T2 T1 T2

Read(a) Read(a) Read(a)


A=A-100 T=A*0.2 A=A-100

Write(a) A=A-T Write(a)

Read(b) Write(a) Read(a)

B=B+100 Read(b) T=A*0.2

Write(b) B=B+T A=A-T

Read(a) Write(b) Write(a)

T=A*02 Read(a) Read(b)

A=A-T A=A-100 B=B+100


Write(b)
Write(a) Write(a)
Read(b)
Read(b) Read(b)
B=B+T
B=B+100
Write(B)
Write(b)

Schedule S1 and S3 are view Equivalent because the values of data item A and B read by
transaction T2 was produced by T1 in both the schedules. This shows the concept of view
serializibility.

b)- serial schedule and serializable schedule.

Schedule – a sequences of instructions that specify the chronological order in which instructions
of concurrent transactions are executed.

A schedule for a set of transactions must consist of all instructions of those transactions. It must
preserve the order in which the instructions appear in each individual transaction

So serial schedule is that in which one transaction is followed by other transaction.

In seralizable schedule

Question 6: Are the ACID properties of a transaction essential to ensure the integrity of data?
Give an example of each property.

Ans6-:Yes , the ACID properties of transactions are essential to ensure the integrity of data.
Following are the properties-:
1) Atomicity-: It means that the whether all the changes are made to transaction and no
change is made. For example we have two accounts A and B we want to transfer money from
account A to B. This means money is to be subtracted from account A and added to account B.
According to this property both these operations made simultaneously or none is made.
2) Consistency-: It means that database should remain consistent at the end of transaction
i.e if we consider the above example the sum of amount in the database before or after
transaction should be remains same i.e A+B will be same before or after transaction.
3) Isolation-: This means that when the two users are using same database the changes will
be made both of them concurrently i.e the data used during the execution of one transaction
cannot be used by the other transaction until the first one is completed.
4) Durability-: It means that the once the transaction is commited it make changes to the
database instead of any errors or failures. The system must be durable.
All these four properties ensure the integrity of data. Any of these properties can bring the
difference in the database.

Vous aimerez peut-être aussi