Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts.

Slides:



Advertisements
Similar presentations
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Advertisements

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.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Appendix B: Advanced.
7.1 Chapter 7: Relational Database Design. 7.2 Chapter 7: Relational Database Design Features of Good Relational Design Atomic Domains and First Normal.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Relational Database Design - part 2 - Database Management Systems I Alex Coman,
Nov 11, 2003Murali Mani Normalization B term 2004: lecture 7, 8, 9.
1 Database Design Theory Which tables to have in a database Normalization.
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Refining an ER Diagram Given the F.D.s: sid  dname.
Relational Database Design Theory Lecture 6. The Banking Schema branch = (branch_name, branch_city, assets) customer = (customer_id, customer_name, customer_street,
Relational Database Design
1 Multi-valued Dependencies. 2 Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized. Consider a.
MVDs: 1 Join Dependencies—Example Let r = A B C = A B |  | A C 1 a x 1 a 1 x 1 a y 1 b 1 y 1 b x 2 a 2 y 1 b y 2 b 2 a y 2 b y Observe: r =  AB r | 
Relational Database Design Theory Lecture 6. Relational Database Design Features of Good Relational Design First Normal Form Decomposition Using Functional.
Boyce-Codd Normal Form By: Thanh Truong. Boyce-Codd Normal Form Eliminates all redundancy that can be discovered by functional dependencies But, we can.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Introduction to Schema Refinement
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 8: Relational.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan Chapter 7: Relational Database Design.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2 Chapter 7: Relational Database Design First Normal Form Goals of Relational.
Computing & Information Sciences Kansas State University Monday, 13 Oct 2008CIS 560: Database System Concepts Lecture 18 of 42 Monday, 13 October 2008.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Copyright © Curt Hill Schema Refinement III 4 th NF and 5 th NF.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design Pitfalls in.
Chapter 13 Further Normalization II: Higher Normal Forms.
Further Normalization II: Higher Normal Forms Prof. Yin-Fu Huang CSIE, NYUST Chapter 13.
CS143 Review: Normalization Theory Q: Is it a good table design? We can start with an ER diagram or with a large relation that contain a sample of the.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
Computing & Information Sciences Kansas State University Wednesday, 04 Oct 2006CIS 560: Database System Concepts Lecture 17 of 42 Wednesday, 04 October.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Database System Concepts ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational Database.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Appendix B: Advanced.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Database System Concepts, 5th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 7: Relational.
Multivalued Dependencies Fourth Normal Form Tony Palladino 157B.
Mid3 Revision 2 Prof. Sin Min Lee Deparment of Computer Science San Jose State University.
Lecture 17 4 th Normal Form Prof. Sin-Min Lee Department of Computer Science.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
Objectives of Normalization  To create a formal framework for analyzing relation schemas based on their keys and on the functional dependencies among.
Computing & Information Sciences Kansas State University Friday, 03 Oct 2007CIS 560: Database System Concepts Lecture 16 of 42 Wednesday, 03 October 2007.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
More on Decompositions and Third Normal Form CIS 4301 Lecture Notes Lecture /16/2006.
Gergely Lukács Pázmány Péter Catholic University
Higher Forms of Normalization
Module 5: Overview of Database Design -- Normalization
Chapter 8: Relational Database Design
Normalization Refine data To attain a good DB design
Chapter 7: Relational Database Design
11/12/2018.
Fourth normal form: 4NF.
Module 5: Overview of Normalization
Chapter 7: Relational Database Design
Normalization Murali Mani.
Normal Form: 4 & 5.
Decomposition and Higher Forms of Normalization
Chapter 7: Relational Database Design
Chapter 7: Relational Database Design
Chapter 7a: Overview of Database Design -- Normalization
Presentation transcript:

Chapter 7: Relational Database Design

©Silberschatz, Korth and Sudarshan7.2Database System Concepts

©Silberschatz, Korth and Sudarshan7.3Database System Concepts

©Silberschatz, Korth and Sudarshan7.4Database System Concepts

©Silberschatz, Korth and Sudarshan7.5Database System Concepts Example R = (student_id, student_name, course_id, course_name ) F = {student_id  student_name, course_id  course_name } { student_id, course_id } is a candidate key. F c = F R 1 = ( student_id, student_name ) R 2 = ( course_id, course_name ) R 3 = ( student_id, course_id)

©Silberschatz, Korth and Sudarshan7.6Database System Concepts

©Silberschatz, Korth and Sudarshan7.7Database System Concepts Example 2 R = ( A, B, C ) F = { A  BC, B  C } R is not in 3NF F c = { A  B, B  C } Decomposition into: R1 = ( A, B ), R2 = ( B, C ) R1 and R2 are in 3NF

©Silberschatz, Korth and Sudarshan7.8Database System Concepts BCNF VS 3NF always possible to decompose a relation into relations in 3NF and  the decomposition is lossless  dependencies are preserved always possible to decompose a relation into relations in BCNF and  the decomposition is lossless  may not be possible to preserve dependencies

©Silberschatz, Korth and Sudarshan7.9Database System Concepts Candidate keys are (sid, part_id) and (sname, part_id). { sid, part_id }  qty { sname, part_id }  qty sid  sname sname  sid The relation is in 3NF: For sid  sname, … sname is in a candidate key. For sname  sid, … sid is in a candidate key. However, this leads to redundancy and loss of information More Examples SSP sid sname part_id qty

©Silberschatz, Korth and Sudarshan7.10Database System Concepts If we decompose the schema into R 1 = ( sid, sname ), R 2 = ( sid, part_id, qty ) These are in BCNF. The decomposition is dependency preserving. { sname, part_id }  qty can be deduced from  sname  sid(given)  { sname, part_id }  { sid, part_id }(augmentation on (1))  { sid, part_id }  qty(given) and finally transitivity on (2) and (3). SSP sid sname part_id qty

©Silberschatz, Korth and Sudarshan7.11Database System Concepts At a city, for a certain part, the supplier is unique: city part_id  sid. Also, sid  city The relation is not in BCNF: sid  city is not trivial, and … sid is not a superkey It is in 3NF: sid  city … city is in the candidate key of { city, part_id }. If we decompose into ( sid, city ) and ( sid, part_id ) we have BCNF, however { city, part_id }  sid will not be preserved. SUPPLY part_id SUPPLY city part_id sid city sid More Examples

©Silberschatz, Korth and Sudarshan7.12Database System Concepts Design Goals Goal for a relational database design is:  BCNF  lossless join  Dependency preservation If we cannot achieve this, we accept:  3NF  lossless join  Dependency preservation

©Silberschatz, Korth and Sudarshan7.13Database System Concepts

©Silberschatz, Korth and Sudarshan7.14Database System Concepts

©Silberschatz, Korth and Sudarshan7.15Database System Concepts Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized Consider a database classes(course, teacher, book) such that (c,t,b)  classes means that t is qualified to teach c, and b is a required textbook for c The database is supposed to list for each course the set of teachers any one of which can be the course’s instructor, and the set of books, all of which are required for the course (no matter who teaches it).

©Silberschatz, Korth and Sudarshan7.16Database System Concepts There are no non-trivial functional dependencies and therefore the relation is in BCNF Insertion anomalies – i.e., if Sara is a new teacher that can teach database, two tuples need to be inserted (database, Sara, DB Concepts) (database, Sara, Ullman) courseteacherbook database operating systems Avi Hank Sudarshan Avi Jim DB Concepts Ullman DB Concepts Ullman DB Concepts Ullman OS Concepts Shaw OS Concepts Shaw classes Multivalued Dependencies (Cont.)

©Silberschatz, Korth and Sudarshan7.17Database System Concepts Therefore, it is better to decompose classes into: courseteacher database operating systems Avi Hank Sudarshan Avi Jim teaches coursebook database operating systems DB Concepts Ullman OS Concepts Shaw text We shall see that these two relations are in Fourth Normal Form (4NF) Multivalued Dependencies (Cont.)

©Silberschatz, Korth and Sudarshan7.18Database System Concepts Multivalued Dependencies (MVDs) Let R be a relation schema and let   R and   R. The multivalued dependency    holds on R if in any legal relation r(R), for all pairs for tuples t 1 and t 2 in r such that t 1 [  ] = t 2 [  ], there exist tuples t 3 and t 4 in r such that: t 1 [  ] = t 2 [  ] = t 3 [  ] = t 4 [  ] t 3 [  ] = t 1 [  ] t 3 [R –  ] = t 2 [R –  ] t 4 [  ] = t 2 [  ] t 4 [R –  ] = t 1 [R –  ]

©Silberschatz, Korth and Sudarshan7.19Database System Concepts

©Silberschatz, Korth and Sudarshan7.20Database System Concepts MVD (Cont.) Tabular representation of   

©Silberschatz, Korth and Sudarshan7.21Database System Concepts

©Silberschatz, Korth and Sudarshan7.22Database System Concepts

©Silberschatz, Korth and Sudarshan7.23Database System Concepts

©Silberschatz, Korth and Sudarshan7.24Database System Concepts

©Silberschatz, Korth and Sudarshan7.25Database System Concepts

©Silberschatz, Korth and Sudarshan7.26Database System Concepts

©Silberschatz, Korth and Sudarshan7.27Database System Concepts

©Silberschatz, Korth and Sudarshan7.28Database System Concepts X ->> Y is trivial if (a)Y  X or (b)Y U X = R

©Silberschatz, Korth and Sudarshan7.29Database System Concepts

©Silberschatz, Korth and Sudarshan7.30Database System Concepts

©Silberschatz, Korth and Sudarshan7.31Database System Concepts