Functional dependencies 4 Update anomalies - insertion insert the fact that takes Networks - Introduction; the name of the student and the name of the personal tutor have to be entered as well; this is prone to errors inconsistent data can you identify other kinds of update anomalies on this relation?
Functional dependencies 5 Update anomalies - deletion delete the fact that takes HCI, in the original table; relevant information will be also deleted - about T.A Flo and about HCI.
Functional dependencies 6 Update anomalies - modification it is possible to modify an attribute and to bring the relation in an inconsistent state; e.g. it is possible (e.g. by mistake) to modify the value of Database Systems to 1/2cu in just some rows; such situations must be avoided
Functional dependencies 7 Cause … of anomalies redundancy … of redundancy constraints on data that are not considered or expressed in the relational model (or, more specifically, on for a particular relation) (some of) these constraints are called Functional Dependencies (FDs) –(others: multiple dependencies, …)
Functional dependencies 8 To eliminate the problem express the existing functional dependencies this is done by choosing particular forms for relations - normal forms a relation is in a certain normal form if if it does not contain certain kinds of functional dependencies a relation in a certain normal form eliminates certain kinds of update anomalies a relation that is not in a certain normal form can be transformed (decomposed) into an equivalent set of relations - this process is called normalisation
Functional dependencies 9 Functional dependency (FD) R - relation, X and Y - subset of attributes of R X Y iff in every possible legal value of R each X-value has a single Y-value associated time independent (for all time)
Functional dependencies 10 Examples S_id S_name S_id P_Tutor S_id (S_id, P_tutor) P_tutor (S_id, S_name, P_tutor) P_tutor Module Val (S_id, Module) Res (S_id, S_name, P_tutor, Module, Val) Res
Functional dependencies 11 Concepts FD is a semantic concept determinant / dependent trivial / non-trivial FD left-irreducible yes: (S_id, P_tutor) P_tutor no: (S_id, Module) Res closure irreducible set
Functional dependencies 12 Functional diagram S_id City P_tutor S_name S_id Module Res Module
Functional dependencies 13 Closure all FDs that can be derived from a given set S notation S+ Armstrongs inference rules if B A then A B if A B then AC BC if A B and B C then A C sound and complete –other rules can be inferred (make the derivation process easier) –A BC iff A B and A C –A B and C D then AC BD
Functional dependencies 14 Irreducible set S 1 covers S 2 iff S 2 + S 1 + S is irreducible iff RHS of every FD is non-composite all FDs in S are left-irreducible no FD ca be discarded from S without changing S + a database that enforces S enforces, in fact, S + the irreducible set of S is S iff S - irreducible S + = S + more efficient to work with the irreducible set
Functional dependencies 15 Conclusion 2NF, 3NF and BCNF will be defined based on FDs