Database Design and Normalization

Similar documents
Relational Database Design

Database Design and Normalization

Schema Refinement: Other Dependencies and Higher Normal Forms

A few details using Armstrong s axioms. Supplement to Normalization Lecture Lois Delcambre

FUNCTIONAL DEPENDENCY THEORY II. CS121: Relational Databases Fall 2018 Lecture 20

Constraints: Functional Dependencies

Functional Dependencies

CS322: Database Systems Normalization

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 9. Informal exercise from last lecture. Example (from Stanczyk et al.

Relational Design: Characteristics of Well-designed DB

UVA UVA UVA UVA. Database Design. Relational Database Design. Functional Dependency. Loss of Information

Relational Database Design Theory Part II. Announcements (October 12) Review. CPS 116 Introduction to Database Systems

Constraints: Functional Dependencies

Normalization. October 5, Chapter 19. CS445 Pacific University 1 10/05/17

Schema Refinement and Normal Forms

Schema Refinement and Normal Forms

Functional Dependency Theory II. Winter Lecture 21

Databases Lecture 8. Timothy G. Griffin. Computer Laboratory University of Cambridge, UK. Databases, Lent 2009

Introduction. Normalization. Example. Redundancy. What problems are caused by redundancy? What are functional dependencies?

Lossless Joins, Third Normal Form

Relational Database Design

Schema Refinement and Normal Forms. The Evils of Redundancy. Schema Refinement. Yanlei Diao UMass Amherst April 10, 2007

Schema Refinement. Feb 4, 2010

Chapter 10. Normalization Ext (from E&N and my editing)

Databases 2012 Normalization

Chapter 8: Relational Database Design

SCHEMA NORMALIZATION. CS 564- Fall 2015

Schema Refinement. Yanlei Diao UMass Amherst. Slides Courtesy of R. Ramakrishnan and J. Gehrke

Introduction to Data Management. Lecture #7 (Relational DB Design Theory II)

Chapter 3 Design Theory for Relational Databases

Functional Dependencies and Normalization

Chapter 7: Relational Database Design

Chapter 7: Relational Database Design. Chapter 7: Relational Database Design

Plan of the lecture. G53RDB: Theory of Relational Databases Lecture 13. Join dependencies. Multivalued dependencies. Decomposition (non-loss!

Schema Refinement and Normal Forms. Case Study: The Internet Shop. Redundant Storage! Yanlei Diao UMass Amherst November 1 & 6, 2007

Relational Database Design

Schema Refinement & Normalization Theory: Functional Dependencies INFS-614 INFS614, GMU 1

CSC 261/461 Database Systems Lecture 13. Spring 2018

Informationslogistik Unit 7: Conceptual Design of Databases Normalization

CS122A: Introduction to Data Management. Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li

BCNF revisited: 40 Years Normal Forms

Schema Refinement and Normalization

Information Systems for Engineers. Exercise 8. ETH Zurich, Fall Semester Hand-out Due

CS54100: Database Systems

10/12/10. Outline. Schema Refinements = Normal Forms. First Normal Form (1NF) Data Anomalies. Relational Schema Design

Review: Keys. What is a Functional Dependency? Why use Functional Dependencies? Functional Dependency Properties

Lecture #7 (Relational Design Theory, cont d.)

Schema Refinement and Normal Forms

CSC 261/461 Database Systems Lecture 10 (part 2) Spring 2018

Schema Refinement and Normal Forms. Why schema refinement?

Functional Dependencies & Normalization. Dr. Bassam Hammo

Schema Refinement and Normal Forms Chapter 19

Introduction to Data Management CSE 344

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Example (Contd.

The Evils of Redundancy. Schema Refinement and Normal Forms. Example: Constraints on Entity Set. Functional Dependencies (FDs) Refining an ER Diagram

Relational Design Theory

CSC 261/461 Database Systems Lecture 8. Spring 2017 MW 3:25 pm 4:40 pm January 18 May 3 Dewey 1101

Normaliza)on and Func)onal Dependencies

Database Design and Implementation

Design theory for relational databases

CSC 261/461 Database Systems Lecture 11

Schema Refinement & Normalization Theory

11/6/11. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)

CMPT 354: Database System I. Lecture 9. Design Theory

Chapter 3 Design Theory for Relational Databases

Lecture 6 Relational Database Design

12/3/2010 REVIEW ALGEBRA. Exam Su 3:30PM - 6:30PM 2010/12/12 Room C9000

Database System Concepts, 5th Ed.! Silberschatz, Korth and Sudarshan See for conditions on re-use "

Normal Forms 1. ICS 321 Fall Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa

Schema Refinement and Normal Forms

Database Design: Normal Forms as Quality Criteria. Functional Dependencies Normal Forms Design and Normal forms

Practice and Applications of Data Management CMPSCI 345. Lecture 16: Schema Design and Normalization

Copyright is owned by the Author of the thesis. Permission is given for a copy to be downloaded by an individual for the purpose of research and

11/1/12. Relational Schema Design. Relational Schema Design. Relational Schema Design. Relational Schema Design (or Logical Design)

DECOMPOSITION & SCHEMA NORMALIZATION

INF1383 -Bancos de Dados

Relational Normalization: Contents

Introduction to Data Management. Lecture #6 (Relational DB Design Theory)

Relational Design Theory II. Detecting Anomalies. Normal Forms. Normalization

Shuigeng Zhou. April 6/13, 2016 School of Computer Science Fudan University

Normal Forms. Dr Paolo Guagliardo. University of Edinburgh. Fall 2016

A CORRECTED 5NF DEFINITION FOR RELATIONAL DATABASE DESIGN. Millist W. Vincent ABSTRACT

Design Theory for Relational Databases

Chapter 11, Relational Database Design Algorithms and Further Dependencies

The Evils of Redundancy. Schema Refinement and Normalization. Functional Dependencies (FDs) Example: Constraints on Entity Set. Refining an ER Diagram

Functional Dependency and Algorithmic Decomposition

Design Theory for Relational Databases

Schema Refinement and Normal Forms. Chapter 19

CSE 132B Database Systems Applications

Introduction to Data Management. Lecture #6 (Relational Design Theory)

CSE 344 MAY 16 TH NORMALIZATION

Database Normaliza/on. Debapriyo Majumdar DBMS Fall 2016 Indian Statistical Institute Kolkata

Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) [R&G] Chapter 19

Functional Dependencies and Normalization. Instructor: Mohamed Eltabakh

The Evils of Redundancy. Schema Refinement and Normal Forms. Functional Dependencies (FDs) Example: Constraints on Entity Set. Example (Contd.

Jordan University of Science and Technology Faculty of Information Technology CS 728: Advanced Database Systems Midterm Exam 1 st Semester 2010/2011

CSE 344 AUGUST 3 RD NORMALIZATION

Information Systems (Informationssysteme)

DESIGN 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. Spring 2011 Instructor: Hassan Khosravi

Transcription:

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 $35K 1976 Hilbert Hubert $40K 1975 Gauss Gwendolyn $40K 1975 Gauss Gwendolyn $50K 1976 Gauss Greta $40K 1975 Gauss Greta $50K 1976 Pythagoras Peter $15K 1976 Pythagoras Peter $20K 1976 all key (No FD) {Gauss} X {Greta, Gwendolyn} X {$40K, 1975), ( $50K,1976)} EMPLOYEE CHILD (S,Y) independent EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 2

Example Item Department Color c 1 brown t 1 black s 1 brown d 2 green s 2 brown b 2 red b 2 yellow b 2 blue b 3 red b 3 yellow b 3 blue Inventory relation: An item is recorded iff it has a color and is used by a department. An item may have more than color. A department may use more than one item in various colors. It uses all the colors of that item. item fifi color If there is a tuple showing that an item I is sold by a department d, and there is a tuple showing that an item a color c then there is a tuple showing that item I having color is sold by department d. EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 3

Anomalies Inventory relation: - Insertion - Deletion - Update Item Department Color c 1 brown t 1 black s 1 brown d 2 green s 2 brown b 2 red b 2 yellow b 2 blue b 3 red b 3 yellow b 3 blue EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 4

Multivalued Dependencies Generalization to MVD can be defined as follows: Let X, Y1, Y2,, Yn are partition of the column names of R. The generalized MVD X Y1 Y2 Y3 Yn (which means X Yi holds for each set Yi) holds iff R is the join of its projections R1(X,Y1), R2(X,Y2), Rn(X,Yn) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 5

4NF Theorem: An MVD x y holds for R, iff R is the join of its projections R1(x,y) and R2(x,z), where x, y and z are disjoint subsets of attributes. Since y and z are symmetrically treated so X fifi Y holds for R (X,Y,Z) iff X fifi Z holds (complementation) Theorem: A relation R is 4NF if it is in BCNF and all MVDs are FDs. In other words, for every non-trivial X fifi Y, X is a superkey of R, i.e. uniquely determines all attributes through FD. EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 6

Conversion to 4NF If X fifi Y holds for R, then decompose R by two relations (R-Y) and (X Y). Repeat the process, if desired. Example: {employee,child}, {employee, salary,year} Example: {item,color}, {item, dept} EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 7

5NF (PJ/NF) Person Skill Job P5 Comp Prog1 P1 Comp Auto1 P4 Mech Auto2 P2 Mech Auto1 Relation PERSON-USING-SKILLS-ON-JOBS is in BCNF, 4NF Job Auto requires both COMP and MECH skills Anomaly: If we delete (P1, MECH, AUTO) then we must delete (P1,COMP,AUTO) P3 Comp Auto1 EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 8

5NF (PJ/NF) PERSON-USING-SKILLS-ON-JOBS Person Skill Job P5 Comp Prog1 P1 Comp Auto1 P4 Mech Auto2 P2 Mech Auto1 P3 Comp Auto1 HAS-SKILL Person P1 P1 P2 P3 Skill Comp Mech Mech Comp NEEDS-SKILL Skill Job Comp Prog1 Comp Auto1 Mech Auto1 Mech Auto2 Person P1 P1 P1 P2 P3 Job Prog1 Auto2 Auto1 Auto1 Auto1 CAN-USE-SKILL-ON-JOB Person Skill Job P1 Comp Prog1 P1 Comp Auto1 P1 Mech Auto1 P1 Mech Auto2 P2 Mech Auto1 P2 Mech Auto2 P3 Comp Prog1 P3 Comp Auto1 ASSIGNED-TO-JOB Each relation acts as a constraint on the join of the other two relations. EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 9

5NF (PJ/NF) Definition: A relation R has JD *(X,Y,Z, ) iff R R1[x] * R2[Y] * R3[Z} * (join) where X, Y, Z etc. are subsets of attributes of R. - It specifies that every legal instance of of R should have a lossless decomposition into R1, R2, R3 Rn - An MVD is a special case of R with n=2 EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 10

Deduction and Inference About Entries S# P# J# S1 P1 J2 S1 P2 J1 S2 P2 J1 New insertion EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 11

5NF (PJ/NF) Theorem: A relation R is in P-J/NF (5NF) iff every possible JD which holds in R is the result of the candidate keys. (not any other non-key attribute) Example: S(S#,Sname,state,city) JD * ( (S#,Sname,status),(S#,city) ) JD* ( (S#,sname),(S#,status),(Sname,city) ) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 12

5NF (PJ/NF) A relation R(A,B,C) satisfies JD*(AB,AC) (i.e. It is de-composible in 5NF) iff it satisfies the pair of MVDs A B C (MVD is a special case of JD) EE562 Slides and Modified Slides from Database Management Systems, R. Ramakrishnan 13