Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 13. Join dependencies. Multivalued dependencies. Decomposition (non-loss!
|
|
- Christopher Ellis
- 6 years ago
- Views:
Transcription
1 Plan of the lecture G53RDB: Theory of Relational Databases Lecture 13 Multivalued and join dependencies: example. Informal coursework: normalising a relation. Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk Lecture 12 2 Multivalued dependencies A multivalued dependency X Y holds in R if for every two tuples r,s R, if r(x) = s(x) then the sets of Y- values with which r and s occur in R are the same. Formally, I R (r(x,z)) = I R (s(x,z)), where Z is the rest of R s attributes. (Note: definition changed from Lecture 11). In other words, for every b π Y (R): <r(x),b,r(z)> R if, and only if, <s(x),b,s(z)> R (where Z is the rest of R s attributes). Lecture 12 3 Join dependencies Let R be a relation and X 1, X 2,, X n be sets of attributes of R. A join dependency JD*(X 1, X 2,, X n ) holds in R if and only if R is equal to the join of its projections on X 1, X 2,, X n : R = π X1 (R) >< π X2 (R) ><... >< π Xn (R) (join is on common attributes). Multivalued dependency X Y holds for a relation R(X,Y,Z) if, and only if, join dependency JD*(XY,XZ) holds for R. Multivalued dependency is a special case of join dependency where only two attribute sets are involved. Lecture 12 4 Join dependency: example Decomposition (non-loss!): Example from Stanczyk et al: JD*(University, Discipline, Degree) Lecture 12 5 R1 University Discipline Old Town Computing Old Town Mathematics New City Computing Discipline Degree R2 Computing BSc Computing PhD Mathematics PhD R3 University Degree Old Town BSc Old Town PhD New City PhD Lecture
2 Are there any multivalued dependencies in this relation R? Let s check whether University Discipline holds. This means, for every t,s: if t(university) = s(university), I R (t(university,degree) ) = I R (s(university,degree) ). Lecture 12 7 Lecture 12 8 (University) = (University), but I R ((University,Degree) ) = {Computing}, I R ((University,Degree) ) = {Mathematics, Computing}. Let s check whether University Degree holds. Lecture 12 9 Lecture (University) = (University), but I R ((University,Discipline) ) = {BSc,PhD}, I R ((University,Discipline) ) = {PhD}. Similarly for other non-trivial mvds: Discipline Degree, Degree Discipline, Discipline University, Degree University do not hold. Lecture Lecture
3 On the other hand: On the other hand: Café Drinks holds. Cafe Drinks Food I R (Café,Food)(r1) = {Orange juice, Apple juice} Cafe Drinks Food OneCafe Orange juice Salad OneCafe Orange juice Carrot cake OneCafe Apple juice Salad OneCafe Apple juice Carrot cake AnotherCafe Coffee Sandwich AnotherCafe Tea Sandwich r1 r2 r3 r4 r5 r6 OneCafe Orange juice Salad OneCafe Orange juice Carrot cake OneCafe Apple juice Salad OneCafe Apple juice Carrot cake AnotherCafe Coffee Sandwich AnotherCafe Tea Sandwich Lecture Lecture On the other hand: On the other hand: I R (Café,Food)(r1) = I R (C,F)(r2) = I R (C,F)(r3) = I R (C,F)(r4) Cafe Drinks Food I R (Café,Food)(r5) = I R (Cafe,Food)(r6) = {Coffee, Tea} Cafe Drinks Food r1 r2 r3 r4 r5 r6 OneCafe Orange juice Salad OneCafe Orange juice Carrot cake OneCafe Apple juice Salad OneCafe Apple juice Carrot cake AnotherCafe Coffee Sandwich AnotherCafe Tea Sandwich r1 r2 r3 r4 r5 r6 OneCafe Orange juice Salad OneCafe Orange juice Carrot cake OneCafe Apple juice Salad OneCafe Apple juice Carrot cake AnotherCafe Coffee Sandwich AnotherCafe Tea Sandwich Lecture Lecture Informal coursework Informal coursework Consider the following relation PR2 which describes arrangements for a first year programming course. Attributes are: StudentId (e.g. xyz01u), StudentName, TutorId (e.g. gjm), TutorName (e.g. Graham), Date (of the tutorial), Place (of the tutorial, e.g. B53), Assignment (e.g. SimpleGUI), Mark (assuming each student gets a mark for each assignment). Each student has one tutor, tutor may have multiple tutees and give multiple tutorials on different times, there is one tutorial per room, one mark per assignment, one assignment discussed and marked at a tutorial. Determine candidate keys in relation PR2. Normalize to BCNF, 4NF, 5NF. Lecture Lecture
4 Informal coursework Normalising to 2NF Candidate keys: {StudentID, Assignment} {StudentID, Date} (assuming there is one assignment per week) any more? Lecture Functional dependencies: StudentID StudentName, TutorID, TutorName TutorID TutorName Date Assignment (assuming each week there is one assignment) everything else depends on candidate keys any more? I assumed that place of the tutorial may change from week to week so we don t have StudentID Place. Dependencies where determinant is part of a key: StudentID StudentName, TutorID, TutorName Lecture Normalising to 2NF Relation Tutees This means we can separate a relation where everything depends on StudentID - and the rest of PR2 relation. So we have Tutees = π StudentID, StudentName, TutorID, TutorName (PR2) where StudentID is the key Mark = π StudentID, Date, Place, Assignment, Mark (PR2) where candidate keys are {StudentID,Assignment} and {StudentID, Date}. Decomposition is lossless because of Heath s theorem. Lecture Tutees = π StudentID, StudentName, TutorID, TutorName (PR2) Is it in 2NF? The only key is StudentID, so no determinant can be part of a key. Is it in BCNF? Relation Tutees has a functional dependency TutorID TutorName, so it has determinant which is not a key, so it is not in BCNF. Normalisation to BCNF was given as an example in Lecture 10. Tutees is decomposed into Students = π StudentID, StudentName, TutorID, (PR2) Tutors = π TutorID, TutorName (PR2) Lecture Normalising Tutees to BCNF Tutees relation has to be decomposed into Students and Tutors: Students Tutors ST-ID ST-Name Tutor-ID Tutor-ID Tutor-Name 123 John xyz xyz Peter 456 Mary xyz abc Paul 789 Jane abc Mark relation Mark = π StudentID, Date, Place, Assignment, Mark (PR2) where candidate keys are {StudentID,Assignment} and {StudentID, Date}. Is it in 2NF? Is there part of key which is a determinant? No attributes depend on StudentID alone; No attributes depend on Assignment alone; But if there is only one assignment per week, we have a functional dependency Date Assignment! Lecture Lecture
5 Decomposing Mark relation Dates relation We have Dates = π Date, Assignment (Mark) (candidate key: {Date}; there could be several dates during the week when an assignment is discussed, so Assignment is not a key). Marks = π StudentID, Date, Place, Mark (Mark) (candidate key: {StudentID, Date}) Dates = π Date, Assignment (Mark) (candidate key: {Date}) Is it in 2NF? Obviously yes because the only key is a single attribute. Is it in BCNF? Yes, because the only non-trivial functional dependency is on Date. Lecture Lecture Where are we... Marks = π StudentID, Date, Place, Mark (Mark) (candidate key: {StudentID, Date}) Is it in 2NF? Yes, nothing depends on just StudentID or just Date. Is it in BCNF? Yes, Place and Mark don t determine any other attributes. Relation PR2 is decomposed into Students = π StudentID, StudentName, TutorID, (PR2) Tutors = π TutorID, TutorName (PR2) Dates = π Date, Assignment (PR2) Marks = π StudentID, Date, Place, Mark (PR2) All these relations are in BCNF. Lecture Lecture What about mvds? Students relation To have a relation in 4NF, we need to make sure that for every non-trivial mvd X Y, X is a key (or superkey). Non-trivial means that there are other attributes in addition to those in X and Y. So we don t have to check Tutors and Dates relations (which only have two attributes). We also only need to check for mvds where X is not a (super) key. Students = π StudentID, StudentName, TutorID, (PR2) The only non-trivial mvds which we could check where X is not a (super) key are: StudentName TutorID TutorID StudentName. Lecture Lecture
6 StudentName TutorID? TutorID StudentName? Suppose we fix the values for StudentName and StudentID for some tuple s in Students. For example, s = <jxs01u, John Smith, gjm>. The set of TutorID values in its image will be a single id {gjm}. Suppose there is another tuple t which agrees with s on StudentName, but the student is another John Smith with another tutor: t = <jys01u, John Smith, isk> The set of TutorID values is {isk}, different from s. So the mvd does not hold. Lecture Suppose we fix the values for TutorID and StudentID for some tuple s in Students. For example, s = <jxs01u, John Smith, gjm>. The set of StudentName values in its image will be a single name {John Smith}. Suppose there is another tuple t which agrees with s on TutorId, t = <jxb01u, Jane Brown, gjm> The set of StudentName values is {Jane Brown}, different from s. So the mvd does not hold. Lecture Marks = π StudentID, Date, Place, Mark (PR2) Potential bad mvds (20 in total!): StudentID Date StudentID Place StudentID Mark Date StudentID Date Place Date Mark Place StudentID Place Date Place Mark Mark StudentID Mark Date Mark Place {StudentID, Place} Date {StudentID, Place} Mark Lecture Lecture {Date, Place} StudentID {Date, Place} Mark {Place, Mark} StudentID {Place, Mark} Date {Date, Mark} StudentID {Date, Mark} Place Let us show just for one of them that it does not hold: {Date, Place} StudentID Is t possible that there are two tuples s and t from Marks, such that s(date,place) = t(date,place), but I R (s(date,place,mark)) I R (t(date,place,mark)) Consider s = <abc01u, , B53, 60> and t = <xyz01u, , B53, 70>. Clearly, abc01u is in I R (s(date,place,mark)) (and so are ids of all other students who got a mark of 60 on that day) but not in I R (t(date,place,mark)). Lecture Lecture
7 In general, {Date, Place} StudentID does not hold because the missing attribute Mark and StudentID are connected, so Date and Place alone don t determine the set of StudentIDs. The same kind of argument works for all other potential mvds: all four attributes are dependent on each other. Relation Marks has no bad mvds... so it is in 4NF. PR2 is decomposed into Students = π StudentID, StudentName, TutorID, (PR2) Tutors = π TutorID, TutorName (PR2) Dates = π Date, Assignment (PR2) Marks = π StudentID, Date, Place, Mark (PR2) All these relations are in 4NF. Lecture Lecture Fifth normal form (5NF) A relation R is in 5NF if for all non-trivial join dependencies JD*(X 1,,X n ) that hold for R, every X i is a superkey for R. A join dependency is called trivial if one of X i includes all attributes (so projection on X i is R itself). Checking for 5NF We need to check if there are any non-trivial join dependencies in the relations below and if there are, check if each of the projections is on a superkey. Students = π StudentID, StudentName, TutorID, (PR2) Tutors = π TutorID, TutorName (PR2) Dates = π Date, Assignment (PR2) Marks = π StudentID, Date, Place, Mark (PR2) Obviously there cannot be non-trivial join dependencies in Tutors and Dates. Lecture Lecture Checking Students relation for 5NF Students = π StudentID, StudentName, TutorID, (PR2) It can be non-loss decomposed into π StudentID, StudentName (Students) and π StudentID,TutorID, (Students), but both {StudentID, StudentName} and {StudentID, TutorID} are superkeys. It cannot be non-loss decomposed into π StudentID,StudentName (Students) and π StudentName,TutorID, (Students) (we already so this when looking for mvds). Checking Students relation for 5NF π StudentID,StudentName, (Students) >< π StudentName,TutorID, (Students) Students: Students StudentID StudentName TutorID jxs01u John Smith gjm jys01u John Smith isk Lecture Lecture
8 Checking Students relation for 5NF π StudentID,StudentName, (Students) >< π StudentName,TutorID, (Students) Students: π StudentID,StudentName, (Students) >< π StudentName,TutorID (Students) StudentID StudentName TutorID jxs01u John Smith gjm jys01u John Smith isk jys01u John Smith gjm jxs01u John Smith isk Checking Students relation for 5NF Similarly, no other decomposition of Students is lossless, unless each projection involves StudentID. Relation Student is in 5NF. Lecture Lecture Checking for 5NF Marks = π StudentID, Date, Place, Mark (PR2) We already checked for mvds, so the only hope to find a non-loss decomposition is to take three or more projections. Let us check {StudentID, Date}, {Date,Place,Mark}, {StudentID, Mark}. Checking for 5NF π StudentID, Date (Marks) >< π Date, Place, Mark (Marks) >< π (Marks) Marks StudentID,Mark Marks StudentID Date Place Mark abc01u B53 60 xyz01u B53 70 abc01u B53 70 Lecture Lecture Checking for 5NF <abc01u,13.11> π StudentID, Date (Marks) <13.11, B53, 70> π Date, Place, Mark (Marks) <abc01u,70> π StudentID, Date (Marks) <abc01u,13.11, B53, 70> π StudentID, Date (Marks) >< π Date, Place, Mark (Marks) <abc01u,13.11, B53, 70> π StudentID, Date (Marks) >< π Date, Place, Mark (Marks) >< π StudentID,Mark (Marks) But it does not belong to Marks. Summary Really need to check all possible decompositions, but similar argument will show that there are no bad join dependencies in Marks. All our relations are in 5NF. Checking this way whether a relation is in a given normal form an extremely laborious process. Would be nice to know that if one dependency does not hold, then a set of other dependencies also does not hold. Subject of the next lecture. Lecture Lecture
Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 9. Informal exercise from last lecture. Example (from Stanczyk et al.
Plan of the lecture G53RDB: Theory of Relational Databases Lecture 9 Answers to informal coursework Multivalued dependencies 4NF Join dependencies 5NF Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk
More informationDatabase Design and Normalization
Database Design and Normalization Chapter 12 (Week 13) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 1 Multivalued Dependencies Employee Child Salary Year Hilbert Hubert
More informationPlan of the lecture. G53RDB: Theory of Relational Databases Lecture 10. Logical consequence (implication) Implication problem for fds
Plan of the lecture G53RDB: Theory of Relational Databases Lecture 10 Natasha Alechina School of Computer Science & IT nza@cs.nott.ac.uk Logical implication for functional dependencies Armstrong closure.
More informationCS54100: Database Systems
CS54100: Database Systems Keys and Dependencies 18 January 2012 Prof. Chris Clifton Functional Dependencies X A = assertion about a relation R that whenever two tuples agree on all the attributes of X,
More informationRelational Database Design
Relational Database Design Jan Chomicki University at Buffalo Jan Chomicki () Relational database design 1 / 16 Outline 1 Functional dependencies 2 Normal forms 3 Multivalued dependencies Jan Chomicki
More informationDatabases 2012 Normalization
Databases 2012 Christian S. Jensen Computer Science, Aarhus University Overview Review of redundancy anomalies and decomposition Boyce-Codd Normal Form Motivation for Third Normal Form Third Normal Form
More informationSchema Refinement: Other Dependencies and Higher Normal Forms
Schema Refinement: Other Dependencies and Higher Normal Forms Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Higher Normal Forms 1 / 14 Outline 1
More informationDatabases Lecture 8. Timothy G. Griffin. Computer Laboratory University of Cambridge, UK. Databases, Lent 2009
Databases Lecture 8 Timothy G. Griffin Computer Laboratory University of Cambridge, UK Databases, Lent 2009 T. Griffin (cl.cam.ac.uk) Databases Lecture 8 DB 2009 1 / 15 Lecture 08: Multivalued Dependencies
More informationRelational Database Design Theory Part II. Announcements (October 12) Review. CPS 116 Introduction to Database Systems
Relational Database Design Theory Part II CPS 116 Introduction to Database Systems Announcements (October 12) 2 Midterm graded; sample solution available Please verify your grades on Blackboard Project
More informationCSC 261/461 Database Systems Lecture 13. Spring 2018
CSC 261/461 Database Systems Lecture 13 Spring 2018 BCNF Decomposition Algorithm BCNFDecomp(R): Find X s.t.: X + X and X + [all attributes] if (not found) then Return R let Y = X + - X, Z = (X + ) C decompose
More informationCS 4604: Introduc0on to Database Management Systems. B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on
CS 4604: Introduc0on to Database Management Systems B. Aditya Prakash Lecture #15: BCNF, 3NF and Normaliza:on Overview - detailed DB design and normaliza:on pi?alls of bad design decomposi:on normal forms
More informationDatabase Design Issues
Database Design Hugh Darwen hd@thethirdmanifesto.com www.thethirdmanifesto.com CS233.HACD: Introduction to Relational Databases Section 9: Database Design 1 1 A Reducible Relation WIFE_OF_HENRY_VIII Wife#
More information10/12/10. Outline. Schema Refinements = Normal Forms. First Normal Form (1NF) Data Anomalies. Relational Schema Design
Outline Introduction to Database Systems CSE 444 Design theory: 3.1-3.4 [Old edition: 3.4-3.6] Lectures 6-7: Database Design 1 2 Schema Refinements = Normal Forms 1st Normal Form = all tables are flat
More informationFunctional Dependencies. Applied Databases. Not all designs are equally good! An example of the bad design
Applied Databases Handout 2a. Functional Dependencies and Normal Forms 20 Oct 2008 Functional Dependencies This is the most mathematical part of the course. Functional dependencies provide an alternative
More informationSCHEMA NORMALIZATION. CS 564- Fall 2015
SCHEMA NORMALIZATION CS 564- Fall 2015 HOW TO BUILD A DB APPLICATION Pick an application Figure out what to model (ER model) Output: ER diagram Transform the ER diagram to a relational schema Refine the
More informationCS322: Database Systems Normalization
CS322: Database Systems Normalization Dr. Manas Khatua Assistant Professor Dept. of CSE IIT Jodhpur E-mail: manaskhatua@iitj.ac.in Introduction The normalization process takes a relation schema through
More informationCSE 303: Database. Outline. Lecture 10. First Normal Form (1NF) First Normal Form (1NF) 10/1/2016. Chapter 3: Design Theory of Relational Database
CSE 303: Database Lecture 10 Chapter 3: Design Theory of Relational Database Outline 1st Normal Form = all tables attributes are atomic 2nd Normal Form = obsolete Boyce Codd Normal Form = will study 3rd
More informationDatabase Design and Implementation
Database Design and Implementation CS 645 Schema Refinement First Normal Form (1NF) A schema is in 1NF if all tables are flat Student Name GPA Course Student Name GPA Alice 3.8 Bob 3.7 Carol 3.9 Alice
More informationUVA UVA UVA UVA. Database Design. Relational Database Design. Functional Dependency. Loss of Information
Relational Database Design Database Design To generate a set of relation schemas that allows - to store information without unnecessary redundancy - to retrieve desired information easily Approach - design
More informationChapter 10. Normalization Ext (from E&N and my editing)
Chapter 10 Normalization Ext (from E&N and my editing) Outline BCNF Multivalued Dependencies and Fourth Normal Form 2 BCNF A relation schema R is in Boyce-Codd Normal Form (BCNF) if whenever an FD X ->
More informationSchema Refinement & Normalization Theory
Schema Refinement & Normalization Theory Functional Dependencies Week 13 1 What s the Problem Consider relation obtained (call it SNLRHW) Hourly_Emps(ssn, name, lot, rating, hrly_wage, hrs_worked) What
More informationNormal Forms Lossless Join.
Normal Forms Lossless Join http://users.encs.concordia.ca/~m_oran/ 1 Types of Normal Forms A relation schema R is in the first normal form (1NF) if the domain of its each attribute has only atomic values
More informationRelational Design Theory II. Detecting Anomalies. Normal Forms. Normalization
Relational Design Theory II Normalization Detecting Anomalies SID Activity Fee Tax 1001 Piano $20 $2.00 1090 Swimming $15 $1.50 1001 Swimming $15 $1.50 Why is this bad design? Can we capture this using
More informationCMPT 354: Database System I. Lecture 9. Design Theory
CMPT 354: Database System I Lecture 9. Design Theory 1 Design Theory Design theory is about how to represent your data to avoid anomalies. Design 1 Design 2 Student Course Room Mike 354 AQ3149 Mary 354
More informationCSE 344 AUGUST 3 RD NORMALIZATION
CSE 344 AUGUST 3 RD NORMALIZATION ADMINISTRIVIA WQ6 due Monday DB design HW7 due next Wednesday DB design normalization DATABASE DESIGN PROCESS Conceptual Model: name product makes company price name address
More informationDesign Theory. Design Theory I. 1. Normal forms & functional dependencies. Today s Lecture. 1. Normal forms & functional dependencies
Design Theory BBM471 Database Management Systems Dr. Fuat Akal akal@hacettepe.edu.tr Design Theory I 2 Today s Lecture 1. Normal forms & functional dependencies 2. Finding functional dependencies 3. Closures,
More informationCSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018
CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018 Announcement Read Chapter 14 and 15 You must self-study these chapters Too huge to cover in Lectures Project 2 Part 1 due tonight Agenda 1.
More informationCSC 261/461 Database Systems Lecture 11
CSC 261/461 Database Systems Lecture 11 Fall 2017 Announcement Read the textbook! Chapter 8: Will cover later; But self-study the chapter Everything except Section 8.4 Chapter 14: Section 14.1 14.5 Chapter
More informationChapter 3 Design Theory for Relational Databases
1 Chapter 3 Design Theory for Relational Databases Contents Functional Dependencies Decompositions Normal Forms (BCNF, 3NF) Multivalued Dependencies (and 4NF) Reasoning About FD s + MVD s 2 Our example
More informationDatabase Design and Normalization
Database Design and Normalization Chapter 11 (Week 12) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 1 1NF FIRST S# Status City P# Qty S1 20 London P1 300 S1 20 London
More informationConstraints: Functional Dependencies
Constraints: Functional Dependencies Fall 2017 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 42 Schema Design When we get a relational
More informationCOSC 430 Advanced Database Topics. Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago
COSC 430 Advanced Database Topics Lecture 2: Relational Theory Haibo Zhang Computer Science, University of Otago Learning objectives and references You should be able to: define the elements of the relational
More informationChapter 3 Design Theory for Relational Databases
1 Chapter 3 Design Theory for Relational Databases Contents Functional Dependencies Decompositions Normal Forms (BCNF, 3NF) Multivalued Dependencies (and 4NF) Reasoning About FD s + MVD s 2 Remember our
More informationDesign theory for relational databases
Design theory for relational databases 1. Consider a relation with schema R(A,B,C,D) and FD s AB C, C D and D A. a. What are all the nontrivial FD s that follow from the given FD s? You should restrict
More informationCSC 261/461 Database Systems Lecture 8. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101
CSC 261/461 Database Systems Lecture 8 Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101 Agenda 1. Database Design 2. Normal forms & functional dependencies 3. Finding functional dependencies
More informationDesign Theory for Relational Databases. Spring 2011 Instructor: Hassan Khosravi
Design Theory for Relational Databases Spring 2011 Instructor: Hassan Khosravi Chapter 3: Design Theory for Relational Database 3.1 Functional Dependencies 3.2 Rules About Functional Dependencies 3.3 Design
More informationDesign Theory for Relational Databases
Design Theory for Relational Databases FUNCTIONAL DEPENDENCIES DECOMPOSITIONS NORMAL FORMS 1 Functional Dependencies X ->Y is an assertion about a relation R that whenever two tuples of R agree on all
More informationA few details using Armstrong s axioms. Supplement to Normalization Lecture Lois Delcambre
A few details using Armstrong s axioms Supplement to Normalization Lecture Lois Delcambre 1 Armstrong s Axioms with explanation and examples Reflexivity: If X Y, then X Y. (identity function is a function)
More informationDesign Theory for Relational Databases
Design Theory for Relational Databases Keys: formal definition K is a superkey for relation R if K functionally determines all attributes of R K is a key for R if K is a superkey, but no proper subset
More informationRelational Database Design
CSL 451 Introduction to Database Systems Relational Database Design Department of Computer Science and Engineering Indian Institute of Technology Ropar Narayanan (CK) Chatapuram Krishnan! Recap - Boyce-Codd
More informationFunctional Dependency Theory II. Winter Lecture 21
Functional Dependency Theory II Winter 2006-2007 Lecture 21 Last Time Introduced Third Normal Form A weakened version of BCNF that preserves more functional dependencies Allows non-trivial dependencies
More informationCS122A: Introduction to Data Management. Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li
CS122A: Introduction to Data Management Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li 1 Third Normal Form (3NF) v Relation R is in 3NF if it is in 2NF and it has no transitive dependencies
More informationChapter 7: Relational Database Design
Chapter 7: Relational Database Design Chapter 7: Relational Database Design! First Normal Form! Pitfalls in Relational Database Design! Functional Dependencies! Decomposition! Boyce-Codd Normal Form! Third
More informationChapter 7: Relational Database Design. Chapter 7: Relational Database Design
Chapter 7: Relational Database Design Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design Functional Dependencies Decomposition Boyce-Codd Normal Form Third Normal
More informationRelational Design: Characteristics of Well-designed DB
Relational Design: Characteristics of Well-designed DB 1. Minimal duplication Consider table newfaculty (Result of F aculty T each Course) Id Lname Off Bldg Phone Salary Numb Dept Lvl MaxSz 20000 Cotts
More informationChapter 8: Relational Database Design
Chapter 8: Relational Database Design Database System Concepts, 6 th Ed. See www.db-book.com for conditions on re-use Chapter 8: Relational Database Design Features of Good Relational Design Atomic Domains
More informationLossless Joins, Third Normal Form
Lossless Joins, Third Normal Form FCDB 3.4 3.5 Dr. Chris Mayfield Department of Computer Science James Madison University Mar 19, 2018 Decomposition wish list 1. Eliminate redundancy and anomalies 2. Recover
More informationDESIGN THEORY FOR RELATIONAL DATABASES. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018
DESIGN THEORY FOR RELATIONAL DATABASES csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 1 Introduction There are always many different schemas for a given
More informationBut RECAP. Why is losslessness important? An Instance of Relation NEWS. Suppose we decompose NEWS into: R1(S#, Sname) R2(City, Status)
So far we have seen: RECAP How to use functional dependencies to guide the design of relations How to modify/decompose relations to achieve 1NF, 2NF and 3NF relations But How do we make sure the decompositions
More informationCS 186, Fall 2002, Lecture 6 R&G Chapter 15
Schema Refinement and Normalization CS 186, Fall 2002, Lecture 6 R&G Chapter 15 Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus Functional Dependencies (Review)
More informationFUNCTIONAL DEPENDENCY THEORY II. CS121: Relational Databases Fall 2018 Lecture 20
FUNCTIONAL DEPENDENCY THEORY II CS121: Relational Databases Fall 2018 Lecture 20 Canonical Cover 2 A canonical cover F c for F is a set of functional dependencies such that: F logically implies all dependencies
More informationCSC 261/461 Database Systems Lecture 12. Spring 2018
CSC 261/461 Database Systems Lecture 12 Spring 2018 Announcement Project 1 Milestone 2 due tonight! Read the textbook! Chapter 8: Will cover later; But self-study the chapter Chapter 14: Section 14.1 14.5
More informationDatabase Tutorial 2: Functional Dependencies and Normal Forms
Database Tutorial 2: Functional Dependencies and Normal Forms 2015-02-10 1. (9 points) Modeling and Design flight airline prime operating departure departure destination destination aircraft seats code
More information11/6/11. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)
Relational Schema Design Introduction to Management CSE 344 Lectures 16: Database Design Conceptual Model: Relational Model: plus FD s name Product buys Person price name ssn Normalization: Eliminates
More informationIntroduction to Data Management CSE 344
Introduction to Data Management CSE 344 Lectures 18: BCNF 1 What makes good schemas? 2 Review: Relation Decomposition Break the relation into two: Name SSN PhoneNumber City Fred 123-45-6789 206-555-1234
More informationPractice and Applications of Data Management CMPSCI 345. Lecture 16: Schema Design and Normalization
Practice and Applications of Data Management CMPSCI 345 Lecture 16: Schema Design and Normalization Keys } A superkey is a set of a/ributes A 1,..., A n s.t. for any other a/ribute B, we have A 1,...,
More informationRelational-Database Design
C H A P T E R 7 Relational-Database Design Exercises 7.2 Answer: A decomposition {R 1, R 2 } is a lossless-join decomposition if R 1 R 2 R 1 or R 1 R 2 R 2. Let R 1 =(A, B, C), R 2 =(A, D, E), and R 1
More informationSchema Refinement and Normal Forms
Schema Refinement and Normal Forms UMass Amherst Feb 14, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke, Dan Suciu 1 Relational Schema Design Conceptual Design name Product buys Person price name
More informationInformation Systems (Informationssysteme)
Information Systems (Informationssysteme) Jens Teubner, TU Dortmund jens.teubner@cs.tu-dortmund.de Summer 2015 c Jens Teubner Information Systems Summer 2015 1 Part VII Schema Normalization c Jens Teubner
More informationCSE 544 Principles of Database Management Systems
CSE 544 Principles of Database Management Systems Lecture 3 Schema Normalization CSE 544 - Winter 2018 1 Announcements Project groups due on Friday First review due on Tuesday (makeup lecture) Run git
More informationSchema Refinement and Normal Forms. Why schema refinement?
Schema Refinement and Normal Forms Why schema refinement? Consider relation obtained from Hourly_Emps: Hourly_Emps (sin,rating,hourly_wages,hourly_worked) Problems: Update Anomaly: Can we change the wages
More informationIntroduction to Management CSE 344
Introduction to Management CSE 344 Lectures 17: Design Theory 1 Announcements No class/office hour on Monday Midterm on Wednesday (Feb 19) in class HW5 due next Thursday (Feb 20) No WQ next week (WQ6 due
More informationComp 5311 Database Management Systems. 5. Functional Dependencies Exercises
Comp 5311 Database Management Systems 5. Functional Dependencies Exercises 1 Assume the following table contains the only set of tuples that may appear in a table R. Which of the following FDs hold in
More informationSchema Refinement. Feb 4, 2010
Schema Refinement Feb 4, 2010 1 Relational Schema Design Conceptual Design name Product buys Person price name ssn ER Model Logical design Relational Schema plus Integrity Constraints Schema Refinement
More informationDECOMPOSITION & SCHEMA NORMALIZATION
DECOMPOSITION & SCHEMA NORMALIZATION CS 564- Spring 2018 ACKs: Dan Suciu, Jignesh Patel, AnHai Doan WHAT IS THIS LECTURE ABOUT? Bad schemas lead to redundancy To correct bad schemas: decompose relations
More information11/1/12. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)
Relational Schema Design Introduction to Management CSE 344 Lectures 16: Database Design Conceptual Model: Relational Model: plus FD s name Product buys Person price name ssn Normalization: Eliminates
More informationReview: Keys. What is a Functional Dependency? Why use Functional Dependencies? Functional Dependency Properties
Review: Keys Superkey: set of attributes whose values are unique for each tuple Note: a superkey isn t necessarily minimal. For example, for any relation, the entire set of attributes is always a superkey.
More informationChapter 11, Relational Database Design Algorithms and Further Dependencies
Chapter 11, Relational Database Design Algorithms and Further Dependencies Normal forms are insufficient on their own as a criteria for a good relational database schema design. The relations in a database
More informationFunctional Dependencies and Normalization
Functional Dependencies and Normalization There are many forms of constraints on relational database schemata other than key dependencies. Undoubtedly most important is the functional dependency. A functional
More informationFunctional Dependencies
Functional Dependencies Functional Dependencies Framework for systematic design and optimization of relational schemas Generalization over the notion of Keys Crucial in obtaining correct normalized schemas
More informationConstraints: Functional Dependencies
Constraints: Functional Dependencies Spring 2018 School of Computer Science University of Waterloo Databases CS348 (University of Waterloo) Functional Dependencies 1 / 32 Schema Design When we get a relational
More informationINF1383 -Bancos de Dados
INF1383 -Bancos de Dados Prof. Sérgio Lifschitz DI PUC-Rio Eng. Computação, Sistemas de Informação e Ciência da Computação Projeto de BD e Formas Normais Alguns slides são baseados ou modificados dos originais
More informationSchema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007
Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 The Evils of Redundancy Redundancy is at the root of several problems associated
More informationLectures 6. Lecture 6: Design Theory
Lectures 6 Lecture 6: Design Theory Lecture 6 Announcements Solutions to PS1 are posted online. Grades coming soon! Project part 1 is out. Check your groups and let us know if you have any issues. We have
More informationLecture #7 (Relational Design Theory, cont d.)
Introduction to Data Management Lecture #7 (Relational Design Theory, cont d.) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements
More informationL13: Normalization. CS3200 Database design (sp18 s2) 2/26/2018
L13: Normalization CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 2/26/2018 274 Announcements! Keep bringing your name plates J Page Numbers now bigger (may change slightly)
More informationHKBU: Tutorial 4
COMP7640 @ HKBU: Tutorial 4 Functional Dependency and Database Normalization Wei Wang weiw AT cse.unsw.edu.au School of Computer Science & Engineering University of New South Wales October 17, 2014 Wei
More informationDatabase System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "
Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See www.db-book.com for conditions on re-use " Features of Good Relational Design! Atomic Domains and First Normal Form! Decomposition
More informationInformationslogistik Unit 7: Conceptual Design of Databases Normalization
Informationslogistik Unit 7: Conceptual Design of Databases Normalization 17. V. 2011 Outline 1 Organization 2 SQL: Regular Expressions and Date Functions 3 Reminder and Overview 4 Normalization First
More informationCSE 344 MAY 16 TH NORMALIZATION
CSE 344 MAY 16 TH NORMALIZATION ADMINISTRIVIA HW6 Due Tonight Prioritize local runs OQ6 Out Today HW7 Out Today E/R + Normalization Exams In my office; Regrades through me DATABASE DESIGN PROCESS Conceptual
More informationIntroduction to Database Systems CSE 414. Lecture 20: Design Theory
Introduction to Database Systems CSE 414 Lecture 20: Design Theory CSE 414 - Spring 2018 1 Class Overview Unit 1: Intro Unit 2: Relational Data Models and Query Languages Unit 3: Non-relational data Unit
More informationExam 1 Solutions Spring 2016
Exam 1 Solutions Spring 2016 Problem 1 1. R 1 := σ color= red OR color= green (P arts) Result := Π sid (R 1 Catalog) 2. R 1 := σ sname= Y osemitesham (Suppliers) R 2 := Π pid,cost (R 1 Catalog) R 3 (pid1,
More informationIntroduction to Data Management. Lecture #7 (Relational DB Design Theory II)
Introduction to Data Management Lecture #7 (Relational DB Design Theory II) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Announcements v Homework
More informationInformation Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due
Information Systems for Engineers Exercise 8 ETH Zurich, Fall Semester 2017 Hand-out 24.11.2017 Due 01.12.2017 1. (Exercise 3.3.1 in [1]) For each of the following relation schemas and sets of FD s, i)
More informationCSE 344 AUGUST 6 TH LOSS AND VIEWS
CSE 344 AUGUST 6 TH LOSS AND VIEWS ADMINISTRIVIA WQ6 due tonight HW7 due Wednesday DATABASE DESIGN PROCESS Conceptual Model: name product makes company price name address Relational Model: Tables + constraints
More informationNormal Forms 1. ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa
ICS 321 Fall 2013 Normal Forms 1 Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 9/16/2013 Lipyeow Lim -- University of Hawaii at Manoa 1 The Problem with
More informationSchema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1
Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1 Background We started with schema design ER model translation into a relational schema Then we studied relational
More informationSchema Refinement and Normal Forms. Chapter 19
Schema Refinement and Normal Forms Chapter 19 1 Review: Database Design Requirements Analysis user needs; what must the database do? Conceptual Design high level descr. (often done w/er model) Logical
More informationRelational Design Theory
Relational Design Theory CSE462 Database Concepts Demian Lessa/Jan Chomicki Department of Computer Science and Engineering State University of New York, Buffalo Fall 2013 Overview How does one design a
More informationNormalization. October 5, Chapter 19. CS445 Pacific University 1 10/05/17
Normalization October 5, 2017 Chapter 19 Pacific University 1 Description A Real Estate agent wants to track offers made on properties. Each customer has a first and last name. Each property has a size,
More informationSchema Refinement and Normal Forms Chapter 19
Schema Refinement and Normal Forms Chapter 19 Instructor: Vladimir Zadorozhny vladimir@sis.pitt.edu Information Science Program School of Information Sciences, University of Pittsburgh Database Management
More informationNormal Forms. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016
Normal Forms Dr Paolo Guagliardo University of Edinburgh Fall 2016 Example of bad design BAD Title Director Theatre Address Time Price Inferno Ron Howard Vue Omni Centre 20:00 11.50 Inferno Ron Howard
More informationL14: Normalization. CS3200 Database design (sp18 s2) 3/1/2018
L14: Normalization CS3200 Database design (sp18 s2) https://course.ccs.neu.edu/cs3200sp18s2/ 3/1/2018 367 Announcements! Keep bringing your name plates J Outline today - More Normalization - Project 1
More informationHomework 2 (by Prashasthi Prabhakar) Solutions Due: Wednesday Sep 20, 11:59pm
CARNEGIE MELLON UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE 15-445/645 DATABASE SYSTEMS (FALL 2017) PROF. ANDY PAVLO Homework 2 (by Prashasthi Prabhakar) Solutions Due: Wednesday Sep 20, 2017 @ 11:59pm IMPORTANT:
More informationRelational Database Design
Relational Database Design Chapter 15 in 6 th Edition 2018/4/6 1 10 Relational Database Design Anomalies can be removed from relation designs by decomposing them until they are in a normal form. Several
More informationThe Evils of Redundancy. Schema Refinement and Normalization. Functional Dependencies (FDs) Example: Constraints on Entity Set. Refining an ER Diagram
The Evils of Redundancy Schema Refinement and Normalization Chapter 1 Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus Redundancy is at the root of several problems
More informationFunctional Dependency and Algorithmic Decomposition
Functional Dependency and Algorithmic Decomposition In this section we introduce some new mathematical concepts relating to functional dependency and, along the way, show their practical use in relational
More informationPlan of the lecture. G53RDB: Theory of Relational Databases Lecture 2. More operations: renaming. Previous lecture. Renaming.
Plan of the lecture G53RDB: Theory of Relational Lecture 2 Natasha Alechina chool of Computer cience & IT nza@cs.nott.ac.uk Renaming Joins Definability of intersection Division ome properties of relational
More informationFunctional Dependencies & Normalization. Dr. Bassam Hammo
Functional Dependencies & Normalization Dr. Bassam Hammo Redundancy and Normalisation Redundant Data Can be determined from other data in the database Leads to various problems INSERT anomalies UPDATE
More informationSchema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007
Schema Refinement and Normal Forms Yanlei Diao UMass Amherst November 1 & 6, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke 1 Case Study: The Internet Shop DBDudes Inc.: a well-known database consulting
More information