1 / 32

COMP 630E Group Project

COMP 630E Group Project. An Illustration of Data Dependencies. Group 2. Ko Wai Sun, Eric Leung Cheuk Yung, Victor Ng Ching Yu, Cedric Wong Yee Man, Shirley. Outline. The Example Functional Dependency (FD) Inclusion Dependency (IND) Multivalued Dependency (MVD)

vanig
Download Presentation

COMP 630E Group Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMP 630E Group Project An Illustration of Data Dependencies Group 2 Ko Wai Sun, Eric Leung Cheuk Yung, Victor Ng Ching Yu, Cedric Wong Yee Man, Shirley

  2. Outline • The Example • Functional Dependency (FD) • Inclusion Dependency (IND) • Multivalued Dependency (MVD) • Join Dependency (JD)

  3. Example Database • Consider the following example • A database is designed to record the information about students, professors and courses taken in a semester. • Click to view the schema and relations of the database.

  4. Data Dependency • Data dependency (DD) is a part of integrity constrains that forms the basis of relation data model and is used to express the semantics of the database. • In this project, we have three main categories of DD • Functional Dependency (FD) • Inclusion Dependency (IND) • Multivalued Dependency (MVD) & Join Dependency (JD)

  5. Functional Dependency (FD) • FD imposes restrictions within a single schema. • It restricts the data in the database follows certain kind of rules. • Armstrong’s Relations generalize six important rules in describing the FD in schema

  6. Functional Dependency (FD) • Consider thestudentrelation

  7. Functional Dependency (FD) • Reflexivity • If Y X  schema(R) then we have F├XY. • Example • sname  sfullname => F ├ sfullname  sname • each student’s name (sname) is a subset of his/her full name (sfullname). Hence we can determine the student’s name from his/her full name.

  8. Functional Dependency (FD) • Augmentation • If F├XY and W is a (set of) attribute(s) in the schema, then F├XWYW • Example • F ├ sid  sprogram => F ├ {sid, sdept}  {sprogram, sdept} • A student’s student ID (sid) can determine his/her program of study (sprogram). • Then the student’s ID together with his/her belonging department can determine the program he/she is studying together with the department he/she belongs to.

  9. Functional Dependency (FD) • Transitivity • If F├XY and F├YZ, then F├XZ. • Example • F├ sid  sprogram and F├ sprogram  sdeptthen F├ sid  sdept • Student identity number (sid) determines the program (sprogram) he/she has registered, and each program must refer to a department (sdept). We can find the department that the student belongs to by the student identity number.

  10. Functional Dependency (FD) • Union • If F├XY and F├XZ, then F├XYZ. • Example • F├ sid  sname and F├ sid  sprogramthen F├ sid  {sname, sprogram} • Student ID (sid) determines the name of the student (sname), it also determines the program the student has registered (sprogram). • Thus if we know the student ID, we can altogether know the student name and the program of that student.

  11. Functional Dependency (FD) • Decomposition • If F├XYZ, then F├XY and F├XZ. • Example • F├ sid  {sprogram, sdept}then F├ sid  sprogram and F├ sid  sdept. • Student ID (sid) determines the program registered (sprogram) and the department he/she belongs to (sdept). • With this student ID, we can find the program he/she has registered and the department he/she belongs to separately.

  12. Functional Dependency (FD) • Pseudo-transitivity • If F├XY and F├YWZ, then F├XWZ. • Example • If F├ sid  sname and F├ {sname, sprogram}  sdept , then F├ {sid, sprogram}  sdept • Student ID (sid) determines the student name (sname). Knowing the student name and the program that he/she has registered (sprogram), we can know the department he/she belongs to (sdept). • Then, if we know the student ID of the student and the the registered program, we can know the department this student belongs to.

  13. Inclusion Dependency (IND) • IND is the rule among different schemas • Consider the student and department relations student department

  14. Inclusion Dependency (IND) • In the student relation, we only have the student ID of the student and his/her corresponding department ID number. • Normally every student must belong to a department. • There should not exist that the relation contains a department with an unknown department identity number, or that the department has no identity number.

  15. Inclusion Dependency (IND) • Just the same as FD, there is a tool to formulate the IND between schemas • This tool is called “Casanova et al.’s axiom system” • We consider the following three rules: • Reflexivity • Projection and Permutation • Transitivity

  16. Inclusion Dependency (IND) • Reflexivity • If X is (are) attribute(s) in a schema R, we have IND├ R[X]  R[X]. • Example • In student relation, IND ├ student[sid]  student[sid] • It gives the basis of inclusion dependency.

  17. Inclusion Dependency (IND) • Projection and permutation • If IND├R1[X]R2[Y], then IND├R1[Xk]R2[Yk] where Xk and Yk are projection and permutation on X and Y • Example • In the teach relation, course ID and the course description are subset of records in the course relation. If we use course ID as referential key to the course relation, there must exist some records in course relation for the same description as the course description.

  18. Inclusion Dependency (IND) teach course teach[{course, cdescription}] course[{course, cdescription, credit}]=> teach[cdescription]  course[cdescription]

  19. Inclusion Dependency (IND) • Transitivity • If IND├R1[X]R2[Y] and IND├R2[Y]R3[Z], then IND├R1[X]R3[Z] • Example • In the pattern relation, it records what courses a student needs to take and only the course ID is known. It is trivial that the course ID is a subset of the course ID in the teach relation. As course ID in the teach relation is also a subset of that in the course relation, from the pattern relation, we can use the course ID as referential key to the course relation.

  20. Inclusion Dependency (IND) If IND├ pattern[course]  teach[course] pattern teach

  21. Inclusion Dependency (IND) and IND├ teach[course]  course[course] teach course

  22. Inclusion Dependency (IND) then IND├ pattern[course]  course[course] pattern course

  23. Multivalued Dependency (MVD) & Join Dependency (JD) • The third type of DD is related to the decomposition restriction on a single schema. • This includes multivalued dependency (MVD) and join dependency (JD)

  24. Multivalued Dependency (MVD) • Notation: MVD ├ A  B • Example • In the relation pattern. An MVD deptcourse is satisfied. • t1 [dept] = t2 [dept] = t3 [dept] = t4 [dept] = 1 • t3 [course] = t1 [course] = COMP104 • t4 [course] = t2[course] = COMP171 • Also, t5 [dept] = t6 [dept] = t7 [dept] = t8 [dept] = 2 • t7 [course] = t5 [course] = ELEC102 • t8 [course] = t6 [course] = ELEC151

  25. Multivalued Dependency (MVD) student requirement

  26. Multivalued Dependency (MVD) pattern Two students in the same department take the same courses

  27. Multivalued Dependency (MVD) • Example (cont’d) • In other words, students in the same department follow the same study pattern to take courses. • Students (1001, 1002) in the Computer Sci. department take COMP104 and COMP171 • and those (1003, 1004) in the Electronic Eng. department take ELEC102 and ELEC151. • Example

  28. Join Dependency (JD) • JD is the general version of MVD • If the schema can be broken up into n (n≥1) or more schema losslessly, the schema obeys JD. • particularly, when n=1, it is the trivial case. • when n=2, it is actually MVD.

  29. Join Dependency (JD) • Example • In the relation enrollment • JD ((student, course), (course, lecturer), (student, lecturer)) holds, • but JD ((student,course), (course,lecturer)) does not. enrollment

  30. Join Dependency (JD) • Decompose the relation enrollment into 3 relations as follows

  31. Join Dependency (JD) • When the three relations are joined back together, it will be the same as before decomposing. • But joining the first two relations ((student, course), (course, lecturer)) would generate some spurious results. • The natural join is as shown in the next slide

  32. Join Dependency (JD) The tuples with red values are spurious. They do not exist in the original enrollment relation. Therefore the JD of joining these two relations does not hold.

More Related