Normalization. FarkasCSCE 5202 Reading Assignments  Database Systems The Complete Book: Chapters 3.6, 3.7, 3.8  Following lecture slides are modified.

Slides:



Advertisements
Similar presentations
Schema Refinement: Canonical/minimal Covers
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Normalization 1 Instructor: Mohamed Eltabakh Part II.
Logical Database Design (3 of 3) John Ortiz. Lecture 7Logical Database Design (2)2 Normalization  If a relation is not in BCNF or 3NF, we refine it by.
CS 440 Database Management Systems Practice problems for normalization.
Chapter 11 Functional Dependencies. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.11-2 Topics in this Chapter Basic Definitions Trivial.
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.
1 Normalization. 2 Normal Forms v If a relation is in a certain normal form (BCNF, 3NF etc.), it is known that certain kinds of redundancies are avoided/minimized.
©Silberschatz, Korth and Sudarshan Relational Database Design First Normal Form Pitfalls in Relational Database Design Functional Dependencies Decomposition.
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 8 Normal Forms Based on Functional Dependencies Deborah Costa Oct 18, 2007.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design First Normal.
Normalization DB Tuning CS186 Final Review Session.
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,
CMSC424: Database Design Instructor: Amol Deshpande
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
Decomposition By Yuhung Chen CS157A Section 2 October
1 Normalization Anomalies Boyce-Codd Normal Form 3 rd Normal Form.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Cs3431 Normalization Part II. cs3431 Attribute Closure : Example Consider R (A, B, C, D, E) with FDs A  B, B  C, CD  E Does A  E hold ? (Is A  E.
Fall 2001Arthur Keller – CS 1804–1 Schedule Today Oct. 4 (TH) Functional Dependencies and Normalization. u Read Sections Project Part 1 due. Oct.
Department of Computer Science and Engineering, HKUST Slide 1 7. Relational Database Design.
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.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Functional Dependencies Prof. Yin-Fu Huang CSIE, NYUST Chapter 11.
Computing & Information Sciences Kansas State University Monday, 13 Oct 2008CIS 560: Database System Concepts Lecture 18 of 42 Monday, 13 October 2008.
Chapter 7: Relational Database Design. 7.2Unite International CollegeDatabase Management Systems Chapter 7: Relational Database Design Features of Good.
Database Management Systems Chapter 3 The Relational Data Model (III) Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
Chapter 7: Relational Database Design. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Chapter 7: Relational Database Design Pitfalls in.
Relational Database Design by Relational Database Design by Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
Schema Refinement and Normalization. Functional Dependencies (Review) A functional dependency X  Y holds over relation schema R if, for every allowable.
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
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.
Lecture 09: Functional Dependencies. Outline Functional dependencies (3.4) Rules about FDs (3.5) Design of a Relational schema (3.6)
Design Theory for Relational Databases 2015, Fall Pusan National University Ki-Joune Li.
CSCI 4333 Database Design and Implementation – Exercise (3) Xiang Lian The University of Texas – Pan American Edinburg, TX
CSC271 Database Systems Lecture # 28.
SCUJ. Holliday - coen 1784–1 Schedule Today: u Normal Forms. u Section 3.6. Next u Relational Algebra. Read chapter 5 to page 199 After that u SQL Queries.
THIRD NORMAL FORM (3NF) A relation R is in BCNF if whenever a FD XA holds in R, one of the following statements is true: XA is a trivial FD, or X is.
Computing & Information Sciences Kansas State University Tuesday, 27 Feb 2007CIS 560: Database System Concepts Lecture 18 of 42 Tuesday, 27 February 2007.
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
Functional Dependencies. Outline Functional dependencies (3.4) Rules about FDs (3.5) Design of a Relational schema (3.6)
Third Normal Form (3NF) Zaki Malik October 23, 2008.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Lecture 3 Functional Dependency and Normal Forms Prof. Sin-Min Lee Department of Computer Science.
Ch 7: Normalization-Part 1
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
© D. Wong Functional Dependencies (FD)  Given: relation schema R(A1, …, An), and X and Y be subsets of (A1, … An). FD : X  Y means X functionally.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Computing & Information Sciences Kansas State University Friday, 03 Oct 2007CIS 560: Database System Concepts Lecture 16 of 42 Wednesday, 03 October 2007.
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
Normal Forms Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems June 18, 2016 Some slide content courtesy of Susan Davidson.
Formal definition of a key A key is a set of attributes A 1,..., A n such that for any other attribute B: A 1,..., A n  B A minimal key is a set of attributes.
Advanced Normalization
Schedule Today: Next After that Normal Forms. Section 3.6.
Normalization First Normal Form (1NF) Boyce-Codd Normal Form (BCNF)
Relational Database Design by Dr. S. Sridhar, Ph. D
CS 480: Database Systems Lecture 22 March 6, 2013.
Advanced Normalization
Functional Dependencies
Anomalies Boyce-Codd Normal Form 3rd Normal Form
Presentation transcript:

Normalization

FarkasCSCE 5202 Reading Assignments  Database Systems The Complete Book: Chapters 3.6, 3.7, 3.8  Following lecture slides are modified from Jeff Ullman’s slides for Fall Stanford

FarkasCSCE 5203 Closures  Closure of attributes (A + ): find keys  Closure of FDs (S + ): projection of FDs to decompositions of schema  Canonical cover: minimize the number of functional dependencies Important for updates

FarkasCSCE 5204 Canonical Cover  Combine FDs if possible and eliminate extraneous attributes: Given a set of FDs S, and an FD X  Y Attribute A is extraneous in X if S logically implies (S-{X  Y})  {(X- A)  Y}. Attribute A is extraneous in Y if the set of FDs (S-{X  Y})  {X  (Y-A)} logically implies S.

FarkasCSCE 5205 Canonical Cover  No functional dependency in S c contains an extraneous attribute  Each left side of a functional dependency in S c is unique.

FarkasCSCE 5206 Example Canonical Cover  Given: 1.A  BC 2.B  C 3.A  B 4.AB  C  Combine 1 and 3 into: A  BC  From 2 and 4: A is extraneous in 4: B  C  C is extraneous in 1: A  B  Result: A  B, B  C

FarkasCSCE 5207 Problems of Relational Database Design  Loss of information (lossless-join)  Inability to represent certain information (dependency preservation)  Repetition of information (normal forms)

FarkasCSCE 5208 Desirable Properties of Decomposition – Lossless-join  Lossless-Join: Let R be a relation schema, S a set of FDs on R, R1 and R2 a decomposition of R. R1 and R2 form a lossless-join decomposition if at least one of the following functional dependencies are in S + R1  R2  R1 R1  R2  R2

FarkasCSCE 5209 Create Lossless-Join Decomposition  Let R be the DB Schema and f: X  Y an FD in S +  Decompose R into two relations R1(X,Y) R2(R-Y)  Continue for each decomposed relation until cannot be decomposed any more

FarkasCSCE Desirable Properties of Decomposition – Dependency Preserving  Dependency Preservation: all dependencies that hold on the original schema should be able to test on individual schemas after decomposition.  Testing dependency preservations on projections is straight forward.

FarkasCSCE Testing dependency preservations on decomposition  Let S be the original set of FDs on R, and S’ the union of FDs on projections R1, R2,…,Rn.  A decomposition is dependency preserving if S’ + =S +

FarkasCSCE Desirable Properties of Decomposition – Avoid Redundancy Owner Name Owner Address Owner PhoneDog NameDog Breed Dog Color Dog Age Viki13 Lake Rd. Irmo, SC PepperG.S.Black3 Viki13 Lake Rd. Irmo, SC BuddyG.S.Brown1 Viki13 Lake Rd. Irmo, SC AlexandraMixGray5 Viki13 Lake Rd. Irmo, SC MissyLabradorBrown5 Pete300 Main St. Columbia, SC HunterVizslaBrown8 Paul99 Apple St Irmo, SC GiantKuvaszWhite4 FD: O.Name  O.Address, O.Phone D.Name, D.Breed  D.Color, D.Age

FarkasCSCE Decomposition and FDs  Functional dependencies: can be used in designing a relational database to remove the undesired properties  Normalization using FDs: Boyce-Codd Normal Form (BCNF) 3 rd Normal Form (3NF)

FarkasCSCE Boyce-Codd Normal Form  A relation is in Boyce-Codd Normal Form if for all FDs X  A in S+ over R at least one of the followings hold: X  A is a trivial FD if X  A is a nontrivial FD then X is a superkey for schema R  Example: R(Name,Breed,Date, Kennel) FD: Name,Breed,Date  Kennel R is in BCNF

FarkasCSCE Decomposition into BCNF  Compute S + (for FDs in S);  if there is a R that is not BCNF then - let X  A a non-trivial FD on R s.t. X  R is not in S + and X  A = ; - Decompose R into: R1(R-A) R2(X,A)

FarkasCSCE BCNF  Not every BCNF decomposition is dependency preserving  Example: FDs: AB  C and C  B Keys: {A,B} and {A,C} C  B is BCNF violation, therefore need to decompose to R1=(AC) and R2=(BC) Decomposition cannot enforce AB  C!

FarkasCSCE Third Normal Form  Modifies BCNF conditions so no need to decompose in this problem situation  An attribute is prime if it is member of any key  X  A violates 3NF if and only if X is not a superkey and also A is not a prime.

FarkasCSCE NF Conditions  A relation is in 3NF if for all FDs X  A in S + over R at least one of the followings hold: X  A is a trivial FD if X  A is a nontrivial FD then X is a superkey for schema R Each attribute B in A-X is contained in a candidate key for R

FarkasCSCE NF and BCNF  BCNF gives Lossless-join No-redundancy Dependency preservation not always possible  3NF gives Lossless-join Dependency preservation May have null values (transitive dependencies)