Hobby Schema SSNNameAddressHobbyCost 123johnmain stdolls$ 123johnmain stbugs$ 345marylake sttennis$$ 456joefirst stdolls$ “Wide” schema – has redundancy.

Slides:



Advertisements
Similar presentations
6.830/6.814 Lecture 3 Sam Madden Relational Algebra and Normalization Sept 10, 2014.
Advertisements

1 Design Theory. 2 Minimal Sets of Dependancies A set of dependencies is minimal if: 1.Every right side is a single attribute 2.For no X  A in F and.
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.
Relational Normalization Theory. Limitations of E-R Designs Provides a set of guidelines, does not result in a unique database schema Does not provide.
EECS 339 Lecture 2 Schema Design, Relational Algebra Jennie Duggan January 13, 2014.
Lossless Decomposition (2) Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Murali Mani Normalization. Murali Mani What and Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert,
Functional Dependencies, Normalization Rose-Hulman Institute of Technology Curt Clifton.
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 227 Database Systems I Design Theory for Relational Databases.
Lossless Decomposition (2) Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Jump to first page Normalization Jump to first page Topics n Why normalization is needed n What causes anomalies n What the 4 normal forms are n How.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Functional Dependencies Definition: If two tuples agree on the attributes A, A, … A 12n then they must also agree on the attributes B, B, … B 12m Formally:
Boyce-Codd Normal Form Kelvin Nishikawa SE157a-03 Fall 2006 Kelvin Nishikawa SE157a-03 Fall 2006.
The principal problem that we encounter is redundancy, where a fact is repeated in more than one tuple. Most common cause: attempts to group into one relation.
1 CMSC424, Spring 2005 CMSC424: Database Design Lecture 9.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Schema Refinement and Normalization Zachary G. Ives University of Pennsylvania CIS 550 – Database & Information Systems October 6, 2004 Some slide content.
BCNF vs 3NF BCNF: For every functional dependency X->Y in a set F of functional dependencies over relation R, either: –Y is a subset of X or, –X is a superkey.
Fall 2001Arthur Keller – CS 1804–1 Schedule Today Oct. 4 (TH) Functional Dependencies and Normalization. u Read Sections Project Part 1 due. Oct.
Functional Dependencies CS 186, Spring 2006, Lecture 21 R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another.
EECS 339 Lecture 3 Normalization Database Internals.
Functional Dependencies and Relational Schema Design.
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.
Normalization B Database Systems Normal Forms Wilhelm Steinbuss Room G1.25, ext. 4041
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Lecture 11 Main Memory Databases Midterm Review. Time breakdown for Shore DBMS Source: “OLTP Under the Looking Glass”, SIGMOD 2008 Systematically removed.
Normalization Goal = BCNF = Boyce-Codd Normal Form = all FD’s follow from the fact “key  everything.” Formally, R is in BCNF if for every nontrivial FD.
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
Announcements Read 5.8 – 5.13 for Monday Project Step 3, due Monday 10/18 Homework 4, due Friday 10/15 – by (or turn in Monday in class)
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Schema Refinement and Normal Forms Chapter 19 1 Database Management Systems 3ed, R.Ramakrishnan & J.Gehrke.
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.
Hobby Schema SSNNameAddressHobbyCost 123johnmain stdolls$ 123johnmain stbugs$ 345marylake sttennis$$ 456joefirst stdolls$ “Wide” schema – has redundancy.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
LECTURE 5: Schema Refinement and Normal Forms SOME OF THESE SLIDES ARE BASED ON YOUR TEXT BOOK.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.
1 Schema Refinement and Normal Forms Week 6. 2 The Evils of Redundancy  Redundancy is at the root of several problems associated with relational schemas:
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
1 Functional Dependencies. 2 Motivation v E/R  Relational translation problems : –Often discover more “detailed” constraints after translation (upcoming.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 15.
Functional Dependencies R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another. Thomas Hobbes ( )
Copyright, Harris Corporation & Ophir Frieder, The Process of Normalization.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CS 338Database Design and Normal Forms9-1 Database Design and Normal Forms Lecture Topics Measuring the quality of a schema Schema design with normalization.
Ch 7: Normalization-Part 1
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
CS542 1 Schema Refinement Chapter 19 (part 1) Functional Dependencies.
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
© 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.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Database Architecture Normalization. Purpose of Normalization A technique for producing a set of relations with desirable properties, given the data requirements.
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.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
LECTURE 5: Schema Refinement and Normal Forms 1. Redundency Problem Redundent Storage Update Anomaly If one copy updated, an inconsistancy may occur Insertion.
4NF & MULTIVALUED DEPENDENCY By Kristina Miguel. Review  Superkey – a set of attributes which will uniquely identify each tuple in a relation  Candidate.
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.
Schema Refinement & Normalization Theory
Relational Algebra and Normalization 9/13/2017
Normalization.
Chapter 19 (part 1) Functional Dependencies
Presentation transcript:

Hobby Schema SSNNameAddressHobbyCost 123johnmain stdolls$ 123johnmain stbugs$ 345marylake sttennis$$ 456joefirst stdolls$ “Wide” schema – has redundancy and anomalies in the presence of updates, inserts, and deletes Entity Relationship Diagram Table key is Hobby, SSN

Schema From ER Diagram SSNNameAddress 123johnmain st 345marylake st 456joefirst st HobbyCost dolls$ bugs$ tennis$$ HobbySSN dolls123 bugs123 tennis345 dolls456 Schema is free of anomalies and redundancy SSNNameAddressHobbyCost 123johnmain stdolls$ 123johnmain stbugs$ 345marylake sttennis$$ 456joefirst stdolls$

Functional Dependencies X  Y Attributes X uniquely determine Y – I.e. for every pair of instances x1, x2 in X, with y1, y2 in Y, if x1=x2, y1=y2 For Hobbies, we have: – SSN, Hobby  Name, Addr, Cost – SSN  Name, Addr – Hobby  Cost

Boyce-Codd Normal Form (BCNF) For a relation R, with FDs of the form X  Y, every FD is either: 1) Trivial (e.g., Y contains X), or 2) X is a superkey; that is, it is a superset of the key of the table If an FD violates 2), then multiple rows with same X value may occur – Indicates redundancy, as rows with given X value all have same Y value – E.g., SSN  Name, Addr in non-decomposed hobbies schema – Name, Addr repeated for each appearance of a given SSN To put a schema into BCNF, create subtables of form XY – E.g., tables where key is left side (X) of one or more FDs – Repeat until all tables in BCNF

BCNFify BCNFify(schema R, functional dependency set F): D = {(R,F)} // D is set of output relations while there is a (schema,FD set) pair (S,F') in D not in BCNF, do: given X->Y as a BCNF-violating dependency in F’ replace (S,F’) in D with S1 = (XY,F1) and S2 = ((S-Y) U X, F2) where F1 and F2 are the FDs in F’ over XY or (S-Y) U X, respectively End return D

BCNFify Example for Hobbies SchemaFDs (S,H,N,A,C)S,H  N,A,C S  N, A H  C S = SSN, H = Hobby, N = Name, A = Addr, C = Cost violates bcnf SchemaFDs (S, N,A)S  N, A SchemaFDs (S,H, C)S,H  C H  C S,H  N, A, C implies S,H  C violates bcnf SchemaFDs (H, C)H  C SchemaFDs (S,H) 3 remaining tables are same as in ER decomposition Iter 1 Iter 2 Did we lose S,H  N,A,C? No! S,H  N, A, C is implied by H  C and S  N,A, since: 1) H  C can be extended to: S,H  C, S 2) S  N, A can be extended to: S, H  N, A, H Since S,H is on left sides of both, can take union, giving S, H  C, S, N, A, H key