Presentation is loading. Please wait.

Presentation is loading. Please wait.

Functional dependencies 1. 2 Outline motivation: update anomalies cause: not expressed constraints on data (FDs) functional dependencies (FDs) definitions.

Similar presentations


Presentation on theme: "Functional dependencies 1. 2 Outline motivation: update anomalies cause: not expressed constraints on data (FDs) functional dependencies (FDs) definitions."— Presentation transcript:

1 Functional dependencies 1

2 2 Outline motivation: update anomalies cause: not expressed constraints on data (FDs) functional dependencies (FDs) definitions examples concepts and terminology (more) advanced theoretical issues (in brief)

3 Functional dependencies 3 Redundancy Student-Modules

4 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?

5 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.

6 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

7 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, …)

8 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

9 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)

10 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

11 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

12 Functional dependencies 12 Functional diagram S_id City P_tutor S_name S_id Module Res Module

13 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

14 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

15 Functional dependencies 15 Conclusion 2NF, 3NF and BCNF will be defined based on FDs


Download ppt "Functional dependencies 1. 2 Outline motivation: update anomalies cause: not expressed constraints on data (FDs) functional dependencies (FDs) definitions."

Similar presentations


Ads by Google