First Normal Form Second Normal Form Third Normal Form

Slides:



Advertisements
Similar presentations
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
Advertisements

Relational Terminology. Normalization A method where data items are grouped together to better accommodate business changes Provides a method for representing.
The Relational Model System Development Life Cycle Normalisation
Normalization of Database Tables
Client/Server Databases and the Oracle 10g Relational Database
1 Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Normalization I.
Chapter 5 Normalization Transparencies © Pearson Education Limited 1995, 2005.
Chapter 5 Normalization of Database Tables
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
1 Minggu 10, Pertemuan 19 Normalization (cont.) Matakuliah: T0206-Sistem Basisdata Tahun: 2005 Versi: 1.0/0.0.
NORMALIZATION N. HARIKA (CSC).
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Normalization Quiz Tao Li Grant Horntvedt. 1. Which of the following statements is true: a. Normal forms can be derived by inspecting the data in various.
1 DATABASE TECHNOLOGIES BUS Abdou Illia, Fall 2007 (Week 3, Tuesday 9/4/2007)
Normalization. Introduction Badly structured tables, that contains redundant data, may suffer from Update anomalies : Insertions Deletions Modification.
Modelling Techniques - Normalisation Description and exemplification of normalisation.Description and exemplification of normalisation. Creation of un-normalised.
Database Design Sections 6 & 7 Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies and Recursive relationships.
CSCI 3140 Module 2 – Conceptual Database Design Theodore Chiasson Dalhousie University.
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
Chapter 6 Normalization 正規化. 6-2 In This Chapter You Will Learn:  更動異常  How tables that contain redundant data can suffer from update anomalies ( 更動異常.
Normalization. 2 Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification of various types of update anomalies.
Database Systems: Design, Implementation, and Management Tenth Edition
Normalization. Learners Support Publications 2 Objectives u The purpose of normalization. u The problems associated with redundant data.
1 DATABASE SYSTEMS DESIGN IMPLEMENTATION AND MANAGEMENT INTERNATIONAL EDITION ROB CORONEL CROCKETT Chapter 7 Normalisation.
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.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
Copyright Ó Oracle Corporation, All rights reserved. Normalization Use the student note section below for further explanation of the slide content.Use.
Normalization Transparencies
CSC271 Database Systems Lecture # 28.
Introduction to Databases Trisha Cummings. What is a database? A database is a tool for collecting and organizing information. Databases can store information.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Chapter 13 Normalization Transparencies. 2 Chapter 13 - Objectives u Purpose of normalization. u Problems associated with redundant data. u Identification.
CIS 210 Systems Analysis and Development Week 6 Part II Designing Databases,
Chapter 13 Normalization © Pearson Education Limited 1995, 2005.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 13 Normalization Transparencies Last Updated: 08 th May 2011 By M. Arief
Chapter 10 Normalization Pearson Education © 2009.
ITN Table Normalization1 ITN 170 MySQL Database Programming Lecture 3 :Database Analysis and Design (III) Normalization.
Normalization Transparencies 1. ©Pearson Education 2009 Objectives How the technique of normalization is used in database design. How tables that contain.
Lecture Nine: Normalization
© Pearson Education Limited, Normalization Bayu Adhi Tama, M.T.I. Faculty of Computer Science University of Sriwijaya.
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,
Brian Thoms.  Databases normalization The systematic way of ensuring that a database structure is suitable for general-purpose querying and free of certain.
IST Database Normalization Todd Bacastow IST 210.
11/10/2009GAK1 Normalization. 11/10/2009GAK2 Learning Objectives Definition of normalization and its purpose in database design Types of normal forms.
Normalization. Overview Earliest  formalized database design technique and at one time was the starting point for logical database design. Today  is.
NormalisationNormalisation Normalization is the technique of organizing data elements into records. Normalization is the technique of organizing data elements.
ITD1312 Database Principles Chapter 4C: Normalization.
Logical Database Design and Relational Data Model Muhammad Nasir
Database Planning Database Design Normalization.
1 Database Design Sections 6 & 7 First Normal Form (1NF), Second Normal Form (2NF), Unique Identifiers (UID), Third Normal Form (3NF), Arcs, Hierarchies.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
Normalization.
Understanding Data Storage
Intro to MIS – MGS351 Relational Database Design
Chapter 14 Normalization
Normalization of Databases
Chapter 14 & Chapter 15 Normalization Pearson Education © 2009.
Chapter 14 Normalization – Part I Pearson Education © 2009.
Relational Database Model
Normalization Dale-Marie Wilson, Ph.D..
Chapter 14 Normalization.
Normalization February 28, 2019 DB:Normalization.
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Chapter 14 Normalization Pearson Education © 2009.
Presentation transcript:

First Normal Form Second Normal Form Third Normal Form Fourth Normal Form Fifth Normal Form cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Topic Objectives This topic discusses Normalization. At the end of the topic, you will be able to: define Normalization identify an entity which is in its First Normal Form identify an entity which is in its Second Normal Form identify an entity which is in its Third Normal Form identify an entity which is in its Fourth Normal Form identify an entity which is in its Fifth Normal Form cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model In this topic, you will see how to systematically assign each attribute to the proper entity. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Normalization In Data Modeling, the term “Normalization” describes the step-by-step process of assigning attributes to entities. A technique for producing a set of relations with desirable properties,given the data requirements of an enterprise. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Purpose of Normalization Characteristics of a suitable set of relations include: the minimal number of attributes necessary to support the data requirements of the enterprise; attributes with a close logical relationship are found in the same relation; minimal redundancy with each attribute represented only once with the important exception of attributes that form all or part of foreign keys.

Purpose of Normalization The benefits of using a database that has a suitable set of relations is that the database will be: easier for the user to access and maintain the data; take up minimal storage space on the computer.

Data Redundancy and Update Anomalies Major aim of relational database design is to group attributes into relations to minimize data redundancy.

Data Redundancy and Update Anomalies Potential benefits for implemented database include: Updates to the data stored in the database are achieved with a minimal number of operations thus reducing the opportunities for data inconsistencies. Reduction in the file storage space required by the base relations thus minimizing costs.

Normalizing Data Model Various authors have identified a number of rules, or principles, of Normalization. Some people claim there are five rules, others identify three or four rules. Everyone aggrees on the first three, and for most business applications, applying the first three principles of Normalization produces a good data model. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model The First Three Rules of Normalization As you tentatively assign an attribute to an entity, you can ask three questions to verify that it (attribute) really belongs there:. 1) will it occur just once? 2) is it dependent on the entire Unique Identifier? 3) is it not dependent on another attribute? If the answer to all three questions is “Yes” then the attribute is in the right place. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Unnormalized Form (UNF) A table that contains one or more repeating groups. To create an unnormalized table Transform the data from the information source (e.g. form) into table format with columns and rows. Pearson Education © 2009

First Normal Form (1NF) A relation in which the intersection of each row and column contains one and only one value. Pearson Education © 2009

UNF to 1NF Nominate an attribute or group of attributes to act as the key for the unnormalized table. Identify the repeating group(s) in the unnormalized table which repeats for the key attribute(s). Pearson Education © 2009

UNF to 1NF Remove the repeating group by Entering appropriate data into the empty columns of rows containing the repeating data (‘flattening’ the table). Or by Placing the repeating data along with a copy of the original key attribute(s) into a separate relation. Pearson Education © 2009

Normalizing Data Model First Normal Form Rule 1: will it occur just once? Here are some examples of attributes that probably meet this first rule: CUSTOMER number first name last name FILM title studio PROJECT start date PART name If we were to ask a business person, “Can a customer have more than one customer number?” or “Can a part have more than one name?” they would probably say “No.” cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Someone might argue that a film could be released under different titles, or could be re-released by a studio other than the one which released it the first time. If this is true, then we must ask our business contact whether they would consider that to be the same film, or two different films. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Here are some examples of attributes which are misplaced, since they obviously violate the rule against repeating data items: CUSTOMER payment amount FILM star actor name PROJECT phone number internal report PART colour The amount of a payment is not a fact that occurs once, for all time, per customer. It is misplaced; there must be another entity representing payments, where each row has a payment amount. The same is true for the attributes. They belong to some other entity. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model If the proper entity already exists, then all you have to do is move the misplaced attribute. If there is no proper entity, you have discovered a new one. You should go back to the beginning with that new entity, properly name it, and determine its relationships and Unique Identifier. PAYMENT amount cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model If you have an entity, DEPARTMENT, which of the following attributes clearly violates the rule against repeating data items? A. name B. manager number C. parent department D. date of hire DEPARTMENT name manager number parent department date of hire The date of hire would occur many times for a DEPARTMENT. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Second Normal Form Rule 2: is it dependent on the entire Unique Identifier? Here are some examples of attributes which depend on (are facts about) their entire UID, where # denotes the UID. MARRIAGE # * husband name # * wife name wedding date photographer COURSE SESSION # * course number # * session number starting date classroom cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model The wedding date and location, the person who officiated, the photographer, etc., are not facts about the husband alone, or the wife alone, but about the combination of them. Likewise, the time and location of a course session are not about the course alone, but about about a course and its specific session. MARRIAGE # * husband name # * wife name wedding date photographer COURSE SESSION # * course number # * session number starting date classroom cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Here are some examples of attributes which are facts about only part of the entity’s UID: MARRIAGE # * husband name # * wife name date of birth colour of hair COURSE SESSION # * course number # * session number title description cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model The date of birth should probably be two separate attributes, one for each spouse. Then it would be completely apparent that those attributes belonged to a different entity. The title and description of a course are very likely the same for every session. In this case, these attributes belong to the COURSE entity, not COURSE SESSION. MARRIAGE # * husband name # * wife name date of birth colour of hair COURSE SESSION # * course number # * session number title description cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Third Normal Form Rule 3: is it not dependent on another attribute? A closely related question is, “Does this attribute depend on something other than its entity’s UID?” cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Here are examples of attributes which are facts about something other than the UID, and therefore fail the third rule of normalization: COURSE SESSION # * course number # * session number starting time classroom number of seats DENTAL TREATMENT # treatment number date of treatment dentist dentist address cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model The number of seats is a fact about the classroom, but not about the UID of the COURSE SESSION entity. If there is not another entity for CLASSROOM, then there should be, and “number of seats” should be one of its attributes. COURSE SESSION # * course number # * session number starting time classroom number of seats DENTAL TREATMENT # treatment number date of treatment dentist dentist address cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model In DENTAL TREATMENT, the dentist’s address is not really a fact about the treatment number. COURSE SESSION # * course number # * session number starting time classroom number of seats DENTAL TREATMENT # treatment number date of treatment dentist dentist address cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form Rule 4: will it not occur several times? This rule forbids the multi-valued relation between the UID and attribute. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form Rule 4: will it not occur several times? This rule forbids the multi-valued relation between the UID and attribute. If the attribute will occur several times then it should belong to another entity. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form EXAMPLE; Let us say that a BANK wants to keep record about sponsor under an entity called CUSTOMER. CUSTOMER # customer id * first name * surname * sponsor cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form EXAMPLE; Let us say that a BANK wants to keep record about sponsor under an entity called CUSTOMER. CUSTOMER # customer id * first name * surname * sponsor What if a CUSTOMER has more than one SPONSOR. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form EXAMPLE; If a CUSTOMER has got more than one sponsor (even if only few times) it must belong to different entity. CUSTOMER # customer id * first name * surname * sponsor sponsored by SPONSOR # sponsor id * name the sponsor of cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form Difference of violation between 1st Normal Form and 4th Normal Form; Repetition of attribute in 1st Normal Form is many times Repetition of attribute in 4th Normal Form is only few times. PAYMENT * amount CUSTOMER # customer id * first name * surname * sponsor Violation of 1st Normal Form Violation of 4th Normal Form cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form Multi-valued relation (even if the occurrence is few times) is not allowed. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form We rarely operate this rule. If applied in all cases, the number of tables in database increases tremendously. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fourth Normal Form Which of the following attributes violates 4th Normal Form? A. address DEFENDANT # defendant number first name last name address B. Surname C. first name D. None cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fifth Normal Form In 5th Normal form; If you have more than 3 candidate UIDs, You should have a different entity for each UID and this should not cause redundancy in data. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fifth Normal Form You can ask a question like following for 5th Normal Form. Has this entity got at least 3 candidate UIDs and can we construct different entities for each candidate UID without data redundancy (repetition). cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fifth Normal Form In practice, this is very difficult. Think of a global information system developed for central government. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fifth Normal Form Following example has got 3 candidate UIDs. Try to define 3 entities corresponding to UIDs EMPLOYEE ? badge number ? social security number ? tax number first name surname date of birth cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Fifth Normal Form Following example has got 3 candidate UIDs. Try to define 3 entities corresponding to UIDs? EMPLOYEE ? badge number ? social security number ? tax number first name surname date of birth ??????? # tax number ??? ??????? # badge number ??? ??? ??????? # social security number ??? Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Summary of Normalization: “Each fact (attribute) must be a fact about the entity, the whole entity, and nothing but the entity” If each attribute of every entity passes this test, then the E-R Diagram is fully normalized. cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Try to stay in first 3 normal forms Normalizing Data Model Try to stay in first 3 normal forms cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner

Normalizing Data Model Do not exaggerate! cetinerg@itu.edu.tr Assoc.Prof.Dr.B.Gültekin Çetiner