LOVELY PROFESSIONAL
UNIVERSITY
HOME WORK: #3
Code : CSE 351
Submitted To:
Mr. Raj Singh
Submitted By:
Vijay Kumar
RA1807 A19
PART – A
Q 1) Consider R (A B C D) and FD’s are
A -> B
C -> B
D -> ABC
AC -> D
Find the minimal set ???
Ans)
A->B
C->B
D->A
D->B
D->C
AC ->D
1)Temp remove A->B
A+=A
A does not define B therefore we cannot remove A->B
2)Temp remove C->B
C+=C
C does not define B therefore we cannot remove C->B
3)Temp remove D->A
D+=DBC
D does not define A therefore we cannot remove D->A
4) Temp remove D->B
D+=DACB
D defines B therefore we can remove it
5)Temp remove D->C
D+=DBA
D does not define C therefore we cannot remove it
Now we consider the case of AC->D
1)Remove A from AC->D and check dependency on C
C+=CDAB
Now without removing A
C+=CB
Both are not matched therefore we cannot remove A
2)Temp remove C and check dependency on A
A+=CDAB
Now without removing C
A+=AB
Both are not matched therefore we cannot remove C
MINIMAL SET:-
A->B
C->B
D->A
D->C
AC->D
Q 2)Consider R ( ABCDEFG) , FD’s are
BCD -> A
BC -> E
A -> F
F -> G
C -> D
A -> G
Decompose upto BCNF ????
Sol)
IN order to decompose it first of all we have to find candidate key. and the candidate
key we can find by finding the closure of each determinant.
BCD+=BCDAEFG
BC+=BCED
A+=AFG
F+=FG
C+=CD
Therefore BCD is a candidate key
The above FD’s are already in 1NF
1)In order to convert it into 2NF we have to remove all partial dependencies
BC->E is a partial dependency, therefore remove E from the relation R and there is a
separate relation for BCE
Now upto 2NF we have
R1=ABCDFG
R2=BCE
2)In order to convert it into 3NF we have to remove transitive dependencies
A->F
F->G
A->G
Now remove F,G from the relation R1 and there is a separate relation for AE,FG,AG
Now upto 3NF we have
R1=ABCD
R2=BCE
R3=AF
R4=FG
R5=AG
Now the remaining FD’s are
BCD->A
C->D
4)in order to convert it into BCNF we have to check it each relation is a candidate
key
And in this case all the relations upto 3NF already in BCNF form
Q 3) In designing a Relational database, why might we choose a non-BCNF design ?
Ans)Because in BCNF it is very difficult to achieve lossless decomposition .Some
time in BCNF we lost our information . there exists no database schema that is both
BCNF and dependence preserving.If we want dependence preserving schema then
we might choose a non BCNF design.
PART – B
Q 4)A Schedule S : Is this Schedule Conflict Schedule S
Serializable ? If yes, What is the Equivalent Serial Schedule ?
T1 T2 T3
READ(A
)
READ(B)
WRITE(
READ(A)
A)
WRITE(B)
WRITE(A
READ(B
)
)
WRITE(
B)
READ(C) READ(C
)
WRITE(C
WRITE( WRITE(B)
)
C)
Q 5)Make a list of Security Concerns for a Bank. For each item on your list, state
whether this concern relates to physical security, human security, operating system
security, or database security.
Ans)Physical security: Physical level
Physical access to computers allows destruction of data by intruders; traditional
lock-and-key security is needed. Computers must also be protected from floods, fire,
etc.
Human Security:-
Users must be screened to ensure that an authorized users do not give access to
intruders Users should be trained on password selection and secrecy.
Operating system security:
Operating system super-users can do anything they want to the database! Good
operating system level security is required
Database security:
Authentication and Authorization mechanisms to allow specific users access only to
required data.
Security concerns for a bank:
Cameras ,metal key, electronic access, Bulletproof screens ,usrename,passwords
Cameras, metal key and electronic access relates to physical security
Bullet proof screens relates to human security
Usernames and passwords relates to database security
6)Which normal form is more desirable ? Justify your answer with the help of an
example ?
Sol)Among all the normal forms 3NF is more desirable, Because after decomposing
upto BCNF there is a chances that decomposition is a lossy decomposition.
But upto 3NF we remove only redundancies ,there is no chance of lossy
decomposition, upto here is a loss less decomposition.
Let us consider a relation upto BCNF
R (ABC),
R1 (AB) , R2(AC)
B -> C
R1 Λ R2 = A
R1 Λ R2 -> R1 : A -> AB
From the above we conclude that A defines A but not B,therefore it is false
R1 Λ R2 -> R2 : A -> AC
From the above we conclude that A defines A but not C,therefore it is false
Therefore it is a lossy decomposition