The Relational Model and Normalization (2) IS 240 – Database Management Lecture #8 2004-02-17 Prof. M. E. Kabay, PhD, CISSP Norwich University

Slides:



Advertisements
Similar presentations
Database Fundamentals
Advertisements

The Relational Model and Normalization (3) IS 240 – Database Management Lecture # Prof. M. E. Kabay, PhD, CISSP Norwich University
The Relational Model and Normalization (1)
Foundations of Relational Implementation (2) IS 240 – Database Management Lecture #14 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Introduction to Database Processing IS 240 – Database Management Lecture #1 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Database Design (1) IS 240 – Database Management Lecture #10 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Foundations of Relational Implementation (1) IS 240 – Database Management Lecture #13 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Database Design (3) IS 240 – Database Management Lecture #12 – Prof. M. E. Kabay, PhD, CISSP Norwich University
1 Copyright © 2004 M. E. Kabay. All rights reserved. Database Design (2) IS 240 – Database Management Lecture #11 – Prof. M. E. Kabay, PhD,
Introduction to Database Development (1) IS 240 – Database Management Lecture #3 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Managing Multi-User Databases (2) IS 240 – Database Management Lecture #19 – Prof. M. E. Kabay, PhD, CISSP Norwich University
SQL IS 240 – Database Management Lecture #15 – Prof. M. E. Kabay, PhD, CISSP Norwich University
E-R Model (1) IS 240 – Database Management Lecture #5 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Introduction to the Course IS301 – Software Engineering Lecture #1 – M. E. Kabay, PhD, CISSP Assoc. Prof. Information Assurance Division of.
Working with MS-ACCESS IS 240 – Database Management Lecture #2 – Assoc. Prof. M. E. Kabay, PhD, CISSP Norwich University
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
0 - 0.
Addition Facts
Fourth normal form: 4NF 1. 2 Normal forms desirable forms for relations in DB design eliminate redundancies avoid update anomalies enforce integrity constraints.
1 Term 2, 2004, Lecture 3, NormalisationMarian Ursu, Department of Computing, Goldsmiths College Normalisation 5.
Relational data integrity
Dependency preservation, 3NF revisited and BCNF
Normal forms - 1NF, 2NF and 3NF
1 Term 2, 2004, Lecture 2, Normalisation - IntroductionMarian Ursu, Department of Computing, Goldsmiths College Normalisation Introduction.
Richmond House, Liverpool (1) 26 th January 2004.
Chapter 5 Normalization of Database Tables
5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Third Normal Form And Database Design.
Functional Dependencies and Normalization for Relational Databases
Addition 1’s to 20.
Test B, 100 Subtraction Facts
Normalisation to 3NF Database Systems Lecture 11 Natasha Alechina.
© 2002 by Prentice Hall 1 SI 654 Database Application Design Winter 2003 Dragomir R. Radev.
Boyce-Codd NF Takahiko Saito Spring 2005 CS 157A.
Normal Forms By Christopher Archibald October 16 th 2007.
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day 5.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 5 The Relational Model and Normalization.
Chapter 3 The Relational Model and Normalization
Lecture 12 Inst: Haya Sammaneh
SQL Normalization Database Design Lecture 5. Copyright 2006Page 2 SQL Normalization Database Design 1 st Normal Form 1 st Normal Form 2 nd Normal Form.
Chapter 5 The Relational Model and Normalization David M. Kroenke Database Processing © 2000 Prentice Hall.
Fundamentals, Design, and Implementation, 9/e. Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/2 Copyright.
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
RDBMS Concepts/ Session 3 / 1 of 22 Objectives  In this lesson, you will learn to:  Describe data redundancy  Describe the first, second, and third.
Chapter 4 The Relational Model and Normalization.
Concepts of Database Management, Fifth Edition
The Relational Model and Normalization R. Nakatsu.
Module III: The Normal Forms. Edgar F. Codd first proposed the process of normalization and what came to be known as the 1st normal form. The database.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Database Normalization Lynne Weldon July 17, 2000.
Normalization of Data  Relatively easy examples from –Discussion –1 st Normal Form –2 nd Normal Form –3 rd Normal Form.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
In this session, you will learn to: Describe data redundancy Describe the first, second, and third normal forms Describe the Boyce-Codd Normal Form Appreciate.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Brian Thoms.  Databases normalization The systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
SLIDE 1IS 257 – Fall 2006 Normalization Normalization theory is based on the observation that relations with certain properties are more effective.
Logical Design & the Relational Model
INLS 623 – Database Normalization
Revised: 2 April 2004 Fred Swartz
Payroll Management System
The Relational Model and Normalization
Database Normalization
Sampath Jayarathna Cal Poly Pomona
Chapter 4 The Relational Model and Normalization
Presentation transcript:

The Relational Model and Normalization (2) IS 240 – Database Management Lecture # Prof. M. E. Kabay, PhD, CISSP Norwich University

2 Copyright © 2004 M. E. Kabay. All rights reserved. Topics Review of Modification Anomalies Essence of Normalization Classes of Relations 1 st – 5 th Normal Forms 2 nd Normal Form 3 rd Normal Form Boyce-Codd Normal Form (BCNF) 4 th Normal Form Homework

3 Copyright © 2004 M. E. Kabay. All rights reserved. Review of Modification Anomalies MemberBook 1:N Member_ID Member_Name Member_Address Member_Etc Book_ID Book_Name Book_ISBN Date_Borrowed Member_ID Date_Returned Book_Location What is the Member_ID if the book isnt out? How can we delete a member if there are still records showing the books (s)he borrowed and returned?

4 Copyright © 2004 M. E. Kabay. All rights reserved. Essence of Normalization We run into problems when an entity tries to include attributes that belong to different relations. * Problems occur when a relation contains facts about two different themes. E.g., Storing information describing a book along with information about when it was borrowed Grouping attributes about a member along with information about what (s)he borrowed * Kroenke p. 127

5 Copyright © 2004 M. E. Kabay. All rights reserved. Normalization (contd) When we try to group information about disparate entities into a single relation, we generate modification anomalies Solution is to break up a relation into separate relations that dont mix themes E.g., store information about the member, information about the book, and information about each borrowing in separate relations

6 Copyright © 2004 M. E. Kabay. All rights reserved. Classes of Relations 1970s: Theorists analyzed anomalies Developed names for different types of problems Named relations as normal forms 1NF = first normal form 2NF = second normal form 3NF = third normal form BCNF = Boyce-Codd normal form 4NF = fourth normal form 5NF = fifth normal form (not used)

7 Copyright © 2004 M. E. Kabay. All rights reserved. 1NF – First Normal Form All the relations that we have defined are 1NF: Each cell contains a single value (no lists, tables, arrays) All instances of an attribute (field, column) must be instances of the same quality Every attribute (field, column) is uniquely identified (same name in all tuples (records, rows) Every tuple (record, row) is unique Order of attributes and tuples is arbitrary – many designs are functionally equivalent A group of one or more attributes (fields, columns) that uniquely identifies a tuple (records, row) is called a key Every relation has at least one key No record (tuple, row) may duplicate another

8 Copyright © 2004 M. E. Kabay. All rights reserved. 1 st – 5 th Normal Forms All relations as we have defined them are always in first normal form (1NF) Other normal forms are subsets of 1NF When we split a relation that is in 1NF we generate some other NF

9 Copyright © 2004 M. E. Kabay. All rights reserved. Classes of Relations (contd) 1NF 2NFAnomalies 3NFAnomalies BCNFAnomalies 4NFAnomalies 5NFAnomalies DK/NFAnomalies Thats all, folks! Boyce-Codd Domain/Key

10 Copyright © 2004 M. E. Kabay. All rights reserved. 1st Normal Form Anomalies LIBRARY Book_ID Book_Name Member_ID Member_Name Date_Borrowed Date_Returned Book_Location Book_ID (Book_Name, Book_Location) Member_ID Member_Name (Book_ID, Member_ID) Date_Borrowed, Date_Returned ANOMALIES: Member has no books out? No one has borrowed a book?

11 Copyright © 2004 M. E. Kabay. All rights reserved. 2NF BOOK Book_ID Book_Name Book_Location MEMBER Member_ID Member_Name BORROWING Book_ID Member_ID Date_Borrowed Date_Returned A relation is in 2NF if all its nonkey attributes are dependent on the entire key. Keys in RED

12 Copyright © 2004 M. E. Kabay. All rights reserved. 2 nd Normal Form (contd) MAJOR_INFO Student_ID Major_Name Director_ID ANOMALIES: How will we know who is running a major before a student registers for that major? How do we keep information about whos running a major if the last student registered withdraws from that major? How many records will we have to update if we change the director of a major? Major_Name Director_ID Student_ID Major_Name Director_ID Transitive dependency Only one major per student Only one director per major

13 Copyright © 2004 M. E. Kabay. All rights reserved. 3NF A relation is in 3NF if it is in 2NF and has no transitive dependencies. STUDENT_MAJOR Student_ID Major_Name MAJOR_DIRECTOR Major_Name Director_ID

14 Copyright © 2004 M. E. Kabay. All rights reserved. 3NF Anomalies ElkinsCardiac110 DouglasICU90 CharliePulmonary70 BakerICU55 AbleCardiac50 NurseWardPatient PATIENT AbleCardiac110 Key: (Patient, Nurse) FD*: Nurse Ward Nurse is a determinant yet it is not a possible (candidate) key Anomaly: removing patient 110 will remove fact that Elkins works in the Cardiac ward 3NF *FD = Functional Dependency

15 Copyright © 2004 M. E. Kabay. All rights reserved. Boyce-Codd Normal Form (BCNF) A relation is in BCNF if every determinant is a candidate key. PatientNurse 50Able 55Baker 70Charlie 90Douglas 110Elkins 110Able WardNurse CardiacAble ICUBaker PulmonaryCharlie ICUDouglas CardiacElkins Patient Nurse Ward

16 Copyright © 2004 M. E. Kabay. All rights reserved. Multi-Value Dependencies Suppose a patient can have several diseases Patient Disease The patient can also have several insurers Patient Insurer Storing complete information about patients would require all combinations of patient, disease and insurer; e.g., Patient_IDDiseaseInsurer ALiverPrudential ALiverLiberty AHeartPrudential AHeartLiberty

17 Copyright © 2004 M. E. Kabay. All rights reserved. 4 th Normal Form A relation is in 4NF if it is in BCNF and has no multi-value dependencies. PatientDisease PatientInsurer

18 Copyright © 2004 M. E. Kabay. All rights reserved. Homework Review Chapter 5 material thoroughly REQUIRED: by Tuesday 24 Feb 2004 For 7 points, complete Group 1 questions 5.11 through 5.17 Study to the end of Chapter 5 and then review the entire chapter carefully By next Tuesday the 24th, Work on Ferrett et al. to complete up to and including Project #6 in time for your mid- term exam OPTIONAL: by THURSDAY THE 26 TH FEB, complete Ch 5 FiredUp Project questions A through H for an extra 8 extra points.

19 Copyright © 2004 M. E. Kabay. All rights reserved. DISCUSSION (Reminder: Mid-term Exam Thu 26 th )