Some Simple Normalization Steps CIT 381. What Normalization Is For Avoid redundancy “One fact in one place” Analyze dependencies among attributes May.

Slides:



Advertisements
Similar presentations
Chapter 5 Normalization of Database Tables
Advertisements

Chapter 5 Normalization of Database Tables
Schema Refinement: Normal Forms
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
Normalization Decomposition techniques for ensuring: Lossless joins Dependency preservation Redundancy avoidance We will look at some normal forms: Boyce-Codd.
NORMALIZATION FIRST NORMAL FORM (1NF): A relation R is in 1NF if all attributes have atomic value = one value for an attribute = no repeating groups =
Normalisation The theory of Relational Database Design.
Ch 10, Functional Dependencies and Normal forms
Relational Normalization Theory. Limitations of E-R Designs Provides a set of guidelines, does not result in a unique database schema Does not provide.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 8 A First Course in Database Systems.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Normalization of Database Tables
1 NORMALISATION. 2 Introduction Overview Objectives Intro. to Subject Why we normalise 1, 2 & 3 NF Normalisation Process Example Summary.
1 Multi-valued Dependencies. 2 Multivalued Dependencies There are database schemas in BCNF that do not seem to be sufficiently normalized. Consider a.
4 TH NORMAL FORM By: Karen McVay. REVIEW OF NFs 1NF  All values of the columns are atomic. That is, they contain no repeating values. 1NF  All values.
Chapter 5 Normalization of Database Tables
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Databases 6: Normalization
Why Normalization? To Reduce Redundancy to 1.avoid modification, insertion, deletion anomolies 2.save space Goal: One Fact in One Place.
July 14, 2015ICS 424: recap1 Relational Database Design: Recap of ICS 324.
Department of Computer Science and Engineering, HKUST Slide 1 7. Relational Database Design.
Chapter 8 Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 29 – 04 – 2005.
Normalization of relational database Data redundance Second Normal Form Third Normal Form Forth Normal Form.
Copyright © Curt Hill Schema Refinement III 4 th NF and 5 th NF.
Relational Database Design by Relational Database Design by Dr.S.Sridhar, Ph.D.(JNUD), RACI(Paris, NICE), RMR(USA), RZFM(Germany) DIRECTOR ARUNAI ENGINEERING.
IS 230Lecture 8Slide 1 Normalization Lecture 9. IS 230Lecture 8Slide 2 Lecture 8: Normalization 1. Normalization 2. Data redundancy and anomalies 3. Spurious.
Database Systems: Design, Implementation, and Management Tenth Edition
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
Your name here. Improving Schemas and Normalization What are redundancies and anomalies? What are functional dependencies and how are they related to.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
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.
Normal Forms through BCNF CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley 2002)
Normalization Ioan Despi 2 The basic objective of logical modeling: to develop a “good” description of the data, its relationships and its constraints.
1 5 Normalization. 2 5 Database Design Give some body of data to be represented in a database, how do we decide on a suitable logical structure for that.
By Abdul Rashid Ahmad. E.F. Codd proposed three normal forms: The first, second, and third normal forms 1NF, 2NF and 3NF are based on the functional dependencies.
CSE314 Database Systems Basics of Functional Dependencies and Normalization for Relational Databases Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E.
Revisit FDs & BCNF Normalization 1 Instructor: Mohamed Eltabakh
IST 210 Normalization 2 Todd Bacastow IST 210. Normalization Methods Inspection Closure Functional dependencies are key.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
What is normalization ? Proposed by Codd in 1972 Takes a relation through a series of steps to certify whether it satisfies a certain normal form Initially.
Normalization.
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
Normalisation 1NF to 3NF Ashima Wadhwa. In This Lecture Normalisation to 3NF Data redundancy Functional dependencies Normal forms First, Second, and Third.
© 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.
11/06/97J-1 Principles of Relational Design Chapter 12.
Objectives of Normalization  To create a formal framework for analyzing relation schemas based on their keys and on the functional dependencies among.
Copyright © Curt Hill Schema Refinement II 2 nd NF to 3 rd NF to BCNF.
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
Relational Data Model, Review Relation Tuple Attribute Domains Candidate key, primary key Key attribute, non-key attribute.
Functional Dependencies and Normalization for Relational Databases تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في ذلك. حيث المرجع.
Normal Forms 1NF – A table that qualifies as a relation is in 1NF. (Back)(Back) 2NF – A relation is in 2NF if all of its nonkey attributes are dependent.
4NF & MULTIVALUED DEPENDENCY By Kristina Miguel. Review  Superkey – a set of attributes which will uniquely identify each tuple in a relation  Candidate.
A brief summary of database normalization
Higher Forms of Normalization
Relational Database Design by Dr. S. Sridhar, Ph. D
Database Normalization
Chapter 6 Normalization of Database Tables
Module 5: Overview of Normalization
Functional Dependencies and Normalization
Mulitvalued Dependencies
Functional Dependencies and Normalization
Normalization Normalization theory is based on the observation that relations with certain properties are more effective in inserting, updating and deleting.
Instructor: Mohamed Eltabakh
NORMALIZATION FIRST NORMAL FORM (1NF):
Chapter 7a: Overview of Database Design -- Normalization
Database Normalization
Functional Dependencies and Normalization
Presentation transcript:

Some Simple Normalization Steps CIT 381

What Normalization Is For Avoid redundancy “One fact in one place” Analyze dependencies among attributes May need to decompose tables into subtables Generally avoided by common sense during design phase.

Example of Redundancy Consider a table containing student info and enrollment info (here CRN means course reference number) student-enroll stud#nameCRN 102Alice15 102Alice17 150Bob15

Clearly Redundant The student-enroll table is clearly bad design. Let’s examine why. Obviously the student information should be kept separately… … in a student table, whose key would be stud#.

Functional Dependency If we know the stud#, we know the name. This is written as stud#  name and is known as a functional dependency.

Partial Dependency A partial dependency is a situation where an attribute in a table can depend on just part of the key, not the whole thing. This is exhibited in the student-enroll table: its key is (stud#, CRN) and a partial dependency is stud#  name

Second Normal Form Partial dependencies in a table are one cause of redundancy. A schema is in second normal form if all partial dependencies have been eliminated. To eliminate them, decompose the offending tables: studentenroll stud#namestud#CRN 102Alice Bob

First Normal Form Hey, where is first normal form? First normal form simply requires that all attributes are atomic, or cannot be broken down into sub-parts. Each attribute value is a single fact. This is pretty much the definition of the relational model.

More Redundancy Consider the CourseOfferings table below, with key CRN: CourseOfferingsInstr CRNtitleinstr#instrName 1778Intro DB16Craig 1426Art Hist18Yolanda 1376French I16Craig

This is in 2nd Normal Form CourseOfferingsInstr CRNtitleinstr#instrName 1778Intro DB16Craig 1426Art Hist18Yolanda 1376French I16Craig No partial dependencies here (there can’t be) …but there is obviously redundancy!

Transitive Dependencies Clearly the Instructor information should have been in a separate table. Why? Because of a transitive dependency: from a key to a non-key to another non-key CRN  instr#  instrName

Third Normal Form First, put schema into 2nd normal form (no partial dependencies). Then ensure there are no transitive dependencies. If so, decompose offending table(s). CourseOffering: CRN title instr# Instructor: instr# instrName

Boyce Codd Normal Form A very formal statement, but worth seeing since BCNF is the gold standard. Let X and Y be sets of attributes. A relation R is in BCNF if for all functional dependencies X  Y that hold on R, either: i)it’s a trivial FD (Y is contained in X), or ii) X is a superkey for R

Higher Normal Forms Suppose we already have tables Instructor, with key instr# Text, with key title Course, with key courseNum Business Rule: A course may be taught several times, by different instructors. Business Rule: The texts used in a course do not depend on the instructor. (That is, another instructor must use the same text(s).)

In BCNF, But Still Redundant CourseInstrText courseNuminstr#text 38114Intro DB 38114SQL 21017Intro Java If we want to add instructor 17 to 381, we must add two lines 38117Intro DB 38117SQL

Fourth Normal Form The table CourseInstrText: courseNum instr# text has no functional dependencies, so is BCNF. But it’s redundant due to a bad multivalued dependency: the set of texts depend on the course. The formalization is long -- let’s skip it. Anyway, the table above is not in 4NF (nor 5NF, 6NF).

Denormalization Sometimes you may not want to decompose a table, usually for the sake of efficiency. (Joins are expensive.) Thus, it may be worth living with redundancy. Two Main Points Do this consciously, not by accident. Be able to justify your decision.