



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




First milestone due September 30
3
How do we tell if a design is bad, e.g., StudentEnroll ( SID , name , CID )? This design has redundancy, because the name of a student is recorded multiple times, once for each course the student is taking
How about a systematic approach to detecting and removing redundancy in designs? Dependencies, decompositions, and normal forms
SID name CID 142 Bart CPS 142 Bart CPS 857 Lisa CPS 857 Lisa CPS ... ... ...
4
X Y Z a b c a?? ... ... ...
X Y Z a b c a b? Must be b (^) ... ... ... Could be anything
5
This is a trivial FD Trivial FD: LHS ⊇ RHS
This is non-trivial, but not completely non-trivial Completely non-trivial FD: LHS ∩ RHS = ∅
6
That is, K is a “super key”
That is, K is minimal
Are some of the FD’s in F redundant (i.e., they follow from the others)?
What are all the keys of R?
Start with closure = Z If X → Y is in F and X is already in the closure, then also add Y to the closure Repeat until no more attributes can be added
9
10
F includes: SID → name , email email → SID SID , CID → grade { CID , email } +^ =? email → SID Add SID ; closure is now { CID , email , SID } SID → name , email Add name , email ; closure is now { CID , email , SID , name } SID , CID → grade Add grade ; closure is now all the attributes in StudentGrade
11
Compute X +^ with respect to F If Y ⊆ X +^ , then X → Y follow from F
Compute K +^ with respect to F If K +^ contains all the attributes of R , K is a super key Still need to verify that K is minimal (how?)
12
Reflexivity: If Y ⊆ X , then X → Y Augmentation: If X → Y , then XZ → YZ for any Z Transitivity: If X → Y and Y → Z , then X → Z
Splitting: If X → YZ , then X → Y and X → Z Combining: If X → Y and X → Z , then X → YZ
attrs ( R ) = attrs ( S ) ∪ attrs ( T ) S = π attrs ( S ) ( R ) T = π attrs ( T ) ( R )
A lossy decomposition is one with R ⊂ S T
Or, the ability to distinguish different original relations
SID CID grade 142 CPS116 B- 142 CPS114 B 123 CPS116 B+ 857 CPS116 A+ 857 CPS130 A+ 456 CPS114 C ... ... ...
SID CID 142 CPS 142 CPS 123 CPS 857 CPS 857 CPS 456 CPS ... ...
SID grade 142 B- 142 B 123 B+ 857 A+ 857 A+ 456 C ... ...
No way to tell which is the original relation
SID CID grade 142 CPS116 B 142 CPS114 B- 123 CPS116 B+ 857 CPS116 A+ 857 CPS130 A+ 456 CPS114 C ... ... ...
21
22
For every non-trivial FD X → Y in R , X is a super key That is, all FDs follow from “key → other attributes”
As long as some relation is not in BCNF
Always decompose on a BCNF violation )Then it is guaranteed to be a lossless join decomposition!
23
That is, a non-trivial FD X → Y in R where X is not a super key of R
R 1 has attributes X ∪ Y R 2 has attributes X ∪ Z , where Z contains all attributes of R that are in neither X nor Y
24
StudentGrade ( SID , name , email , CID , grade ) BCNF violation: SID → name , email
Student ( SID , name , email ) Grade ( SID , CID , grade ) BCNF BCNF
StudentGrade ( SID , name , email , CID , grade ) BCNF violation: email → SID
StudentID ( email , SID ) BCNF StudentGrade’ ( email , name , CID , grade ) BCNF violation: email → name
StudentName ( email , name ) BCNF^ Grade^ ( email ,^ CID ,^ grade ) BCNF
Sure; and it doesn’t depend on the FD
Proof makes use of the fact that X → Y
27
BNCF decomposition is a lossless join decomposition