IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.

Slides:



Advertisements
Similar presentations
4NF and 5NF Prof. Sin-Min Lee Department of Computer Science.
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.
Database Management Systems Chapter 3 The Relational Data Model (II) Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
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.
Functional Dependencies
Functional Dependencies. Babies At a birth, there is one baby (twins would be represented by two births), one mother, any number of nurses, and a doctor.
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Relational Database Design - part 2 - Database Management Systems I Alex Coman,
Multivalued Dependency Prof. Sin-Min Lee Department of Computer Science.
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.
Winter 2002Arthur Keller – CS 1804–1 Schedule Today: Jan. 15 (T) u Normal Forms, Multivalued Dependencies. u Read Sections Assignment 1 due. Jan.
Normalization I.
1 Multivalued Dependencies Fourth Normal Form. 2 A New Form of Redundancy uMultivalued dependencies (MVD’s) express a condition among tuples of a relation.
1 Multi-valued Dependencies. 2 Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized. Consider a.
Fall 2001Arthur Keller – CS 1803–1 Schedule Today Oct. 2 (T) Relational Model. u Read Sections Assignment 1 due. Personal Letter of Introduction.
Winter 2002Arthur Keller – CS 1803–1 Schedule Today: Jan. 10 (TH) u Relational Model, Functional Dependencies. u Read Sections Jan. 15 (T) u Normal.
Bad DB Design Duplicate of data Duplicate of data Updating Updating Deleting Deleting.
Fall 2001Arthur Keller – CS 1804–1 Schedule Today Oct. 4 (TH) Functional Dependencies and Normalization. u Read Sections Project Part 1 due. Oct.
Normalization II. Boyce–Codd Normal Form (BCNF) Based on functional dependencies that take into account all candidate keys in a relation, however BCNF.
Functional Dependencies and Relational Schema Design.
Normalization B Database Systems Normal Forms Wilhelm Steinbuss Room G1.25, ext. 4041
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
FUNCTIONAL DEPENDENCIES
Introduction to Normalization CPSC 356 Database Ellen Walker Hiram College.
Databases 1 Seventh lecture. Topics of the lecture Extended relational algebra Normalization Normal forms 2.
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.
Relational Database Design by Relational Database Design by Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING.
IT420: Database Management and Organization Normalization 31 January 2006 Adina Crăiniceanu
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
1 Pertemuan 23 Normalisasi Matakuliah: >/ > Tahun: > Versi: >
Lecture 6 Normalization: Advanced forms. Objectives How inference rules can identify a set of all functional dependencies for a relation. How Inference.
Database Normalization.
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
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.
BCNF & Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
Normal Forms through BCNF CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
9/23/2012ISC329 Isabelle Bichindaritz1 Normalization.
Normalization. 2 u Main objective in developing a logical data model for relational database systems is to create an accurate representation of the data,
1 Multivalued Dependencies Fourth Normal Form Reasoning About FD’s + MVD’s.
3 Spring Chapter Normalization of Database Tables.
CS 338Database Design and Normal Forms9-1 Database Design and Normal Forms Lecture Topics Measuring the quality of a schema Schema design with normalization.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Functional Dependencies Zaki Malik September 25, 2008.
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
Functional Dependencies. Babies Exercise 2.2.5: At a birth, there is one baby (twins would be represented by two births), one mother, any number of nurses,
Databases 1 Sixth lecture. 2 Functional Dependencies X -> A is an assertion about a relation R that whenever two tuples of R agree on all the attributes.
© 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.
Final Review Zaki Malik November 20, Basic Operators Covered.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
ITD1312 Database Principles Chapter 4C: Normalization.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
Logical Database Design and Relational Data Model Muhammad Nasir
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.
Normalization.
Schedule Today: Next After that Normal Forms. Section 3.6.
Cushing, Keller, UlmanJudy Cushing
Schedule Today: Jan. 23 (wed) Week of Jan 28
3.1 Functional Dependencies
Multivalued Dependencies & Fourth Normal Form (4NF)
Functional Dependencies
Multivalued Dependencies
Presentation transcript:

IST 210 Normalization 2 Todd Bacastow IST 210

Normalization Methods Inspection Closure Functional dependencies are key

IST 210 Normal Forms Universe of relations 1 NF 2NF 3NF BCNF 4NF 5NF

IST 210 First Normal Form (1NF) All appropriate data into the empty columns of rows containing the repeating data (‘flattening’ the table), ie, no repeating items in columns

IST 210 Second Normal Form (2NF) In 1NF and every non-key column is fully dependent on the (entire) primary key

IST 210 Third Normal Form (3NF) In 2NF, every non-key column is mutually independent, ie, no transitive dependencies

IST 210 Functional Dependencies Describes the relationship between attributes in a relation Example If A and B are attributes of relation R, A functionally determines B (A  B), if each value of A is associated with exactly one value of B. AB A functionally determines B

IST 210 Functional Dependencies Functional dependencies arise from the nature of the real world that the database models. Often A and B are facts about an entity where A might be some identifier for the entity and B some characteristic. Functional dependencies cannot be automatically determined by studying one or more instances of a database. They can be determined only by a careful study of the real world and a clear understanding of what each attribute means.

IST 210 Functional Dependencies Important as a constraint on the data that may appear within a relation Scheme-level control of data Mathematical tool for explaining the process of “normalization” ---- vital for DB redesigning

IST 210 Example Drinkers (name, addr, beersLiked, manf, favoriteBeer) Reasonable FD’s to assert: name  addr name  favoriteBeer beersLiked  manf Note: these happen to imply the underlined key, but the FD’s give more detail than the mere assertion of a key nameaddrbeerLikedmanffavoriteBeer Jane16801BudA.B.WickedAle Jane16801WickedAlePete’sWickedAle Mike16803BudA.B.Bud

IST 210 Example (cont.) Key (in general) functionally determines all attributes. name beersLiked  addr favoriteBeer beerManf Shorthand: combine FD’s with common left side by concatenating their right sides When FD’s are not of the form (Key)  other attribute(s), then there is typically an attempt to “cram” too much into one relation. Sometimes, several attributes jointly determines another attribute, although neither does by itself. Example: beer bar  price

IST 210 Formal Notion of Key K is a key for relation R if: (1) K  all attributes of R (K functionally determines all the attributes of R) (2) For no proper subset of K is (1) true If K at least satisfies (1), then K is a superkey

IST 210 Example Drinkers (name, addr, beersLiked, manf, favoriteBeer) {name,beerLiked} FD’s all attributes, as seen Shows {name,beerLiked} is a superkey (functionally determines all attributes) name  beersLiked is false, so name not a superkey beersLiked  name also false, so beersLiked not a superkey Thus, {name,beersLiked} is a key No other keys in this example Neither name nor beersLiked is on the right of any observed FD, so they must be part of any superkey

IST 210 Who determines Keys/FD’s We could define a relation schema by simply giving a single key K Then the only FD’s asserted are that K  A for every attribute A No surprise: K is then the only key for those FD’s, according to the formal definition of ‘Key.’ Or, we could assert some FD’s and deduce one or more keys by the formal definition E/R diagram implies FD’s by key declarations and many-to-one relationship declarations

IST 210 Rule of thumb FD’s either come from keyness (i.e., a set of attributes that functionally determines all attributes), many-to-one relationship, or from physics E.g., “no two courses can meet in the same room at the same time” (at least we don’t know a way) yields room time  course

IST 210 Boyce-Codd Normal Form Goal = Boyce-Codd Normal Form BCNF = all FD’s follow from the fact key  everything Formally, R is in BCNF if every nontrivial FD for R, say X  A, has X a superkey (i.e., X functionally determines all attributes). Why important? Guarantees no redundancy due to FD’s Guarantees no update anomalies Guarantees no deletion anomalies Trivial dependency - A dependency is trivial if the functionally determined attribute is a subset of the functionally determining attributes. For instance, ABA AB functionally determines B

IST 210 Using Closure to Reach BCNF The closure of a set F of functional dependencies is the set of all functional dependencies logically implied by F. Setting: relation R, given FD’s F. Suppose relation R has BCNF violation X  B. We need only look among FD’s of F for a BCNF violation. Compute X + (cannot be all attributes) Decompose R into X + and (R-X + )  X. Find the FD’s for the decomposed relations R X X+X+

IST 210 Example Drinkers (name, addr, beersLiked, manf, favoriteBeer) FD’s: name  addr name  favoriteBeer beersLiked  manf Pick BCNF violation name  addr Close the left side: name + = name addr favoriteBeer Decomposed relations: Drinkers1(name,addr,favoriteBeer) Drinkers2(name,beersLiked,manf) New FD’s: For Drinker1: name  addr and name  favoriteBeer (BCNF) For Drinker2: beersLiked  manf (violates BCNF, decompose again)

IST 210 Example (cont.) Final relations all in BCNF Drinker1(name,addr,favoriteBeer) Drinker3(beersLiked,manf) Drinker4(name,beersLiked)