Lossless-join Jan. 2012Yangjun Chen ACS-39021 Outline: Lossless-join Chapter 15 – 3rd ed. (Chap. 15 – 4 th, 5 th ed.; Chap. 16, 6 th ed.) Basic definition.

Slides:



Advertisements
Similar presentations
Chapter 16: Relational Database Design and Further Dependencies
Advertisements

Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Announcements Read 6.1 – 6.3 for Wednesday Project Step 3, due now Homework 5, due Friday 10/22 Project Step 4, due Monday Research paper –List of sources.
Schema Refinement and Normal Forms Given a design, how do we know it is good or not? What is the best design? Can a bad design be transformed into a good.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Further Dependencies by Pinar Senkul resources: mostly froom Elmasri, Navathe and other books.
Chapter 3 Notes. 3.1 Functional Dependencies A functional dependency is a statement that – two tuples of a relation that agree on some particular set.
Functional Dependencies and Normalization for Relational Databases.
 1 CS 728 Advanced Database Systems Chapter 15 Database Design Theory: Normalization Algorithms.
Functional Dependencies and Normalization for Relational Databases
Copyright © 2004 Pearson Education, Inc.. Chapter 11 Relational Database Design Algorithms and Further Dependencies.
 10.1 CS 728 Advanced Database Systems Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Normalization Chapter What it’s all about Given a relation, R, and a set of functional dependencies, F, on R. Assume that R is not in a desirable.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Functional Dependencies and Normalization for Relational Databases by Pinar Senkul resources:
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design Algorithms by Pinar Senkul resources: mostly froom Elmasri, Navathe.
Chapter 11 Relational Database Design Algorithms and Further Dependencies Copyright © 2004 Ramez Elmasri and Shamkant Navathe.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Functional Dependencies and Normalization for Relational Databases.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 6 NORMALIZATION FOR RELATIONAL DATABASES Instructor Ms. Arwa Binsaleh.
Announcements Read 5.8 – 5.13 for Monday Project Step 3, due Monday 10/18 Homework 4, due Friday 10/15 – by (or turn in Monday in class)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Topic 10 Functional Dependencies and Normalization for Relational Databases Faculty of Information Science and Technology Mahanakorn University of Technology.
Instructor: Churee Techawut Functional Dependencies and Normalization for Relational Databases Chapter 4 CS (204)321 Database System I.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide DESIGNING A SET OF RELATIONS (2) Goals: Lossless join property (a must). Dependency.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 4 Normalization.
Top-Down Database Design Mini-world Requirements Conceptual schema E1 E2 R Relation schemas ?
Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Functional Dependencies and Normalization for Relational Databases
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Relational Database Design Algorithms and Further Dependencies.
Chapter Functional Dependencies and Normalization for Relational Databases.
Chapter 11: Relational Database Design Algorithms and Further Dependencies Chapter 11: Relational Database Design Algorithms and Further Dependencies 1.
Normalization Sept. 2012ACS-3902 Yangjun Chen1 Outline: Normalization Chapter 14 – 3rd ed. (Chap. 10 – 4 th, 5 th ed.; Chap. 6, 6 th ed.) Redundant information.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Normalization Sept. 2014ACS-3902 Yangjun Chen1 Outline: Normalization Redundant information and update anomalies Function dependencies Normal forms -1NF,
CS 222 Database Management System Spring Lecture 5 Database Design (Decomposition) Korra Sathya Babu Department of Computer Science NIT Rourkela.
Chapter 7 Functional Dependencies Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Relational Database Design Algorithms and Further Dependencies.
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
10/3/2017.
COP 6726: New Directions in Database Systems
Relational Database Design Algorithms and Further Dependencies
Functional Dependency and Normalization
Introduction to the database systems (1)
CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases.
Functional Dependencies and Normalization for Relational Databases
Outline: Normalization
Relational Database Design Algorithms and Further Dependencies
Relational Database Design
Chapter Outline 1 Informal Design Guidelines for Relational Databases
Presentation transcript:

Lossless-join Jan. 2012Yangjun Chen ACS Outline: Lossless-join Chapter 15 – 3rd ed. (Chap. 15 – 4 th, 5 th ed.; Chap. 16, 6 th ed.) Basic definition of Lossless-join Examples Testing algorithm

Lossless-join Jan. 2012Yangjun Chen ACS Basic definition of Lossless-join A decomposition D = {R 1, R 2,..., R m } of R has the lossless join property with respect to the set of dependencies F on R if, for every relation r of R that satisfies F, the following holds,  (  R1 (r),...,  Rm (r)) = r, where  is the natural join of all the relations in D. The word loss in lossless refers to loss of information, not to loss of tuples.

Lossless-join Jan. 2012Yangjun Chen ACS Example: decomposion-1 SSNPNUMhoursENAME Emp_PROJ PNAMEPLOCATION F = {SSN  ENAME, PNUM  {PNAME, PLOCATION}, {SSN, PNUM}  hours} SSNENAME R1 PNUMPNAMEPLOCATION R2 SSNPNUMhours R3 Lossless join

Lossless-join Jan. 2012Yangjun Chen ACS Example: decomposition-2 SSNPNUMhoursENAME Emp_PROJ PNAMEPLOCATION F = {SSN  ENAME, PNUM  {PNAME, PLOCATION}, {SSN, PNUM}  hours} ENAME R1 SSNPNAME PLOCATION R2 PNUMhours Not lossless join PLOCATION

Lossless-join Jan. 2012Yangjun Chen ACS decomposion-1 A1 SSN A2 ENAME A3 PNUM A4 PNAME A5 PLOCATION A6 hours b11 b21 b31 b12 b22 b32 b13 b23 b33 b14 b24 b34 b15 b25 b35 b16 b26 b36 R1 R2 R3 a1 b21 a1 a2 b22 b32 b13 a3 b14 a4 b34 b15 a5 b35 b16 b26 a6 R1 R2 R3

Lossless-join Jan. 2012Yangjun Chen ACS a1 b21 a1 a2 b22 a2 b13 a3 b14 a4 b34 b15 a5 b35 b16 b26 a6 R1 R2 R3 a1 b21 a1 a2 b22 a2 b13 a3 b14 a4 b15 a5 b16 b26 a6 R1 R2 R3 SSN  ENAME PNUM  {PNAME, PLOCATION} SSNENAME PNUMPNAMEPLOCATION

Lossless-join Jan. 2012Yangjun Chen ACS decomposition-2 A1 SSN A2 ENAME A3 PNUM A4 PNAME A5 PLOCATION A6 hours b11 b21 b12 b22 b13 b23 b14 b24 b15 b25 b16 b26 R1 R2 b11 a1 a2 b22 b13 a3 b14 a4 a5 b16 a6 R1 R2 The matrix can not be changed! SSN  ENAME PNUM  {PNAME, PLOCATION} {SSN, PNUM}  hours

Lossless-join Jan. 2012Yangjun Chen ACS a1a2b13b14b15b16 b21b22a3a4a5a6 a1a2a3a4a5a6 EMP_PROJ Why? R1 b13b14b15 a3a4a5 a1b13b16 b21a3b26 a1a3a6 R2 R3 Decomposition-1:

Lossless-join Jan. 2012Yangjun Chen ACS R1  R3 = R13 = Why? Decomposition-1: R13  R2 =

Lossless-join Jan. 2012Yangjun Chen ACS b11a2b13b14a5b16 a1b22a3a4a5a6 EMP_PROJ Why? R1 b11b13b14a5b16 a1a3a4a5a6 R2 Decomposition-2:

Lossless-join Jan. 2012Yangjun Chen ACS Why? Decomposition-2: R1  R2 = b11a2b13b14a5b16 a1a2a3a4a5a6 b11b22b13b14a5b16 a1b22a3a4a5a6 Spurious tuples

Lossless-join Jan. 2012Yangjun Chen ACS student_nocourse_noinstr_no Instructor’s teach one course only Student takes a course and has one instructor {student_no, course}  instr_no instr_no  course_no Student-course-instructor:

Lossless-join Jan. 2012Yangjun Chen ACS student_nocourse_noinstr_no student_noinstr_no Course_noinstr_no R1 R2 A1 stu-no A2 course-no A3 instr-no b11 b21 b12 b22 b13 b23 R1 R2 A1 stu-no A2 course-no A3 instr-no b11 a1 a2 b22 a3 R1 R2 b11 a1 a2 a3 R1 R2 {student_no, course}  instr_no instr_no  course_no

Lossless-join Jan. 2012Yangjun Chen ACS student_nocourse_noinstr_no student_nocourse_no Course_noinstr_no R1 R2 A1 stu-no A2 course-no A3 instr-no b11 b21 b12 b22 b13 b23 R1 R2 A1 stu-no A2 course-no A3 instr-no b11 a1 a2 a3 b23 R1 R2 b11 a1 a2 a3 b23 R1 R2 instr_no  course_no {student_no, course}  instr_no instr_no  course_no

Lossless-join Jan. 2012Yangjun Chen ACS student_nocourse_noinstr_no student_nocourse_no student_noinstr_no R1 R2 A1 stu-no A2 course-no A3 instr-no b11 b21 b12 b22 b13 b23 R1 R2 A1 stu-no A2 course-no A3 instr-no a1 b12 a2 a3 b23 R1 R2 a1 b12 a2 a3 b23 R1 R2 {student_no, course}  instr_no instr_no  course_no

Lossless-join Jan. 2012Yangjun Chen ACS Testing algorithm input: A relation R, a decomposition D = {R 1, R 2,..., R m } of R, and a set F of function dependencies. 1.Create an initial matrix S with one row i for each relation Ri in D, and one column j for each attribute Aj in R. 2.Set S(i, j) := b ij for all matrix entries. 3.For each row i representing relation schema Ri Do {for each column j representing Aj do {if relation Ri includes attribute Aj then set S(i, j) := a j ;} 4.Repeat the following loop until a complete loop execution results in no changes to S.

Lossless-join Jan. 2012Yangjun Chen ACS Repeat the following loop until a complete loop execution results in no changes to S. {for each function dependency X  Y in F do for all rows in S which have the same symbols in the columns corresponding to attributes in X do {make the symbols in each column that correspond to an attribute in Y be the same in all these rows as follows: if any of the rows has an “a” symbol for the column, set the other rows to the same “a” symbol in the column. If no “a” symbol exists for the attribute in any of the rows, choose one of the “b” symbols that appear in one of the rows for the attribute and set the other rows to that same “b” symbol in the column;}} 5.If a row is made up entirely of “a” symbols, then the decompo- sition has the lossless join property; otherwise it does not.

Lossless-join Jan. 2012Yangjun Chen ACS a1 b21 a1 a2 b22 b32 b13 a3 b14 a4 b34 b15 a5 b35 b16 b26 a6 a2 b21 a1 b22 b32 R1 R2 b13b14b15 a3a4a5 a3 b34 b35 a1b13b16 b21a3b26 a1a3a6 R3 PNUM  {PNAME, PLOCATION} a1