database - Decomposition to BCNF -
while understand normal forms are, have trouble working them. following course in database systems , somehow bit lost on this. have tried google, stackoverflow, slides of course , book, examples seem throw me off track every time. pointers if make wrong assumptions/conclusions along post, pointers missing in end.
a specific exercise ran today this: given db, convert bcnf:
db: ab -> ef f -> ab -> cd
as understand there 2 possible candidate keys here. ab , f. because both able derive entire db, , because both minimal in sense consist of single left hand side.
let's go f primary key.
originally: db(f->ab)
for 1nf there seems no repeating groups. check.
2nf there seems no partial dependencies. (would not impossible f being primary key?)
3nf there's problem! both ab , not keys determines other attributes. solve this, need become keys: (sorry lack of underlining, seems there no option underline)
db(f->ab) r1(ab->ef) r2(a->cd)
as understand it, bcnf, procedure goes this: compare 3nf db original db. find occurences in original db entire left hand side present 3nf db , @ least 1 right hand side present. not quite sure how ever possible not have this. maybe misunderstood part. anyways, continuing;
first occurrence f->ab. primary key , ok.
second occurence ab->ef. since ab candidate key, ok well.
last occurence a->cd. part of candidate key. violates bcnf , must rewritten. , off train completely. have no idea how rewrite this, , not sure if procedure far makes sense. me wrap up?
you're right: a->cd dependency violates bcnf. split relation in two:
- attributes violating dependecy: acd
- attributes right side of violating dependency (a) remaining attributes: abef
this stop functional dependencies conform bcnd rules.
Comments
Post a Comment