Normalisation Exercise

Slides:



Advertisements
Similar presentations
Normalisation. Informal guidelines  Semantics of the attributes  easy to explain relation  doesn’t mix concepts  Reducing the redundant values in.
Advertisements

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.
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 Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
CS Algorithm : Decomposition into 3NF  Obviously, the algorithm for lossless join decomp into BCNF can be used to obtain a lossless join decomp.
Normal Form Design addendum by C. Zaniolo. ©Silberschatz, Korth and Sudarshan7.2Database System Concepts Normal Form Design Compute the canonical cover.
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.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Normalization. FarkasCSCE 5202 Reading Assignments  Database Systems The Complete Book: Chapters 3.6, 3.7, 3.8  Following lecture slides are modified.
Databases 6: Normalization
METU Department of Computer Eng Ceng 302 Introduction to DBMS Relational Database Design Algorithms by Pinar Senkul resources: mostly froom Elmasri, Navathe.
Chapter 14 Advanced Normalization Transparencies © Pearson Education Limited 1995, 2005.
Functional Dependencies and Relational Schema Design.
Normalisation Example CS2312. Normalisation Example BEER_DATABASE Additional Notes: Warehouses are shared by breweries. Each beer is unique to the brewer.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Database Systems Normal Forms. Decomposition Suppose we have a relation R[U] with a schema U={A 1,…,A n } – A decomposition of U is a set of schemas.
Chapter 8: Relational Database Design First Normal Form First Normal Form Functional Dependencies Functional Dependencies Decomposition Decomposition Boyce-Codd.
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.
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.
Normal Forms through BCNF CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Chapter Functional Dependencies and Normalization for Relational Databases.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
Chapter 7 Functional Dependencies Copyright © 2004 Pearson Education, Inc.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
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.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
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.
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Lecture 11: Functional Dependencies
Functional Dependency and Normalization
Advanced Normalization
Chapter 15 Relational Design Algorithms and Further Dependencies
Schedule Today: Next After that Normal Forms. Section 3.6.
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Module 5: Overview of Database Design -- Normalization
Normalization First Normal Form (1NF) Boyce-Codd Normal Form (BCNF)
Canonical Cover & Normal Forms
CPSC-310 Database Systems
Normal Forms.
Relational Database Design by Dr. S. Sridhar, Ph. D
Relational Database Design
CS 480: Database Systems Lecture 22 March 6, 2013.
Chapter 8: Relational Database Design
3.1 Functional Dependencies
Handout 4 Functional Dependencies
Advanced Normalization
Functional Dependencies and Normalization
Canonical Cover & Normal Forms
Normalization Murali Mani.
CSCI 4333 Database Design and Implementation – Exercise (3)
Review  Only two chapters (6 & 7) Normalization Theory Triggers.
Functional Dependencies and Relational Schema Design
Outline: Normalization
Lecture 8: Database Design
Instructor: Mohamed Eltabakh
CSCI 6315 Applied Database Systems – Exercise (5)
Functional Dependencies and Normalization
Lecture 09: Functional Dependencies
CS4222 Principles of Database System
Presentation transcript:

Normalisation Exercise BEER_DATABASE Additional Notes: Warehouses are shared by breweries. Each beer is unique to the brewer. Each brewery is based in a city.

Minimal Sets of Functional Dependencies A set of functional dependencies F is minimal if: 1. Every dependency F has a single determined attribute A 2. We cannot remove any dependency from F and still have a set of dependencies equivalent to F 3. We cannot replace and dependency X  A in F with a dependency A X, where A  X and still have a set of dependencies that is equivalent to F i.e. a canonical form with no redundancies (beer, brewery, strength, city, region, warehouse, quantity) beer brewery beer strength brewery  city city  region beer, warehouse,  quantity

Relational Synthesis Algorithm into 3NF: (beer, brewery, strength, city, region, {warehouse, quantity}) set D := { R } ; 1. Find a minimal cover G for F 2. For each determinant X of a functional dependency that appears in G create a relation schema { X  A1, X  A2…X  Am} in D where X  A1, X  A1, … X  A1m are the only dependencies in G with X as the determinant; 3. Place any remaining (unplaced) attributes in a single relation to ensure attribute preservation property so we don’t lose anything. 4. If none of the relations contains a key of R, create one more relation that contains attributes that form a key for R. beer brewery (beer, brewery, strength) beer strength brewery  city (brewery, city) city  region (city, region) beer, warehouse  quantity (beer, warehouse, quantity)

(beer, brewery, strength, city, region, {warehouse, quantity}) Step-wise normalisation: (beer, brewery, strength, city, region, {warehouse, quantity}) beer brewery, strength partial dependency brewery  city transitive dependency city  region transitive dependency beer, warehouse  quantity repeating group 1NF remove repeating group (beer, brewery, strength, city, region, {warehouse, quantity}) (beer, warehouse, quantity) beer, warehouse,  quantity (beer, brewery, strength, city, region) beer brewery, strength transitive dependency brewery  city transitive dependency city  region

(beer, brewery, strength, city, region) brewery  city transitive dependency city  region transitive dependency 2NF no partial dependencies 3NF/BCNF no transitive dependencies (beer, brewery, strength, city, region) (city, region) city  region (beer, brewery, strength, city) brewery  city (brewery, city) brewery  city (beer, brewery, strength) Take the most indirect transitive dependencies

Using BNCF decomposition algorithm: (beer, brewery, strength, city, region, warehouse, quantity) beer brewery, strength partial dependency brewery  city transitive dependency city  region transitive dependency beer, warehouse,  quantity Directly to BCNF: take a violating dependency and form a relation from it. First choose a direct transitive dependency and its closure (beer, brewery, strength, city, region, warehouse, quantity) brewery  city (brewery, city, region) city  region transitive dependency (beer, brewery, strength, warehouse, quantity) beer brewery, strength partial dependency

Using BNCF decomposition algorithm: (beer, brewery, strength, city, region, warehouse, quantity) beer brewery, strength partial dependency brewery  city transitive dependency city  region transitive dependency beer, warehouse,  quantity take a violating dependency and form a relation from it. First the partial dependency and its closure (beer, brewery, strength, city, region, warehouse, quantity) beer brewery, strength (beer, brewery, strength, city, region) brewery  city transitive dependency city  region transitive dependency normalise as before... (beer, warehouse, quantity)