Normalization of Database



Similar documents
- Eliminating redundant data - Ensuring data dependencies makes sense. ie:- data is stored logically

DATABASE NORMALIZATION

MCQs~Databases~Relational Model and Normalization

DATABASE SYSTEMS. Chapter 7 Normalisation

COSC344 Database Theory and Applications. Lecture 9 Normalisation. COSC344 Lecture 9 1

Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases

Database Normalization. Mohua Sarkar, Ph.D Software Engineer California Pacific Medical Center

If it's in the 2nd NF and there are no non-key fields that depend on attributes in the table other than the Primary Key.

CS 377 Database Systems. Database Design Theory and Normalization. Li Xiong Department of Mathematics and Computer Science Emory University

Chapter 5: Logical Database Design and the Relational Model Part 2: Normalization. Introduction to Normalization. Normal Forms.

Lecture 2 Normalization

Normalisation to 3NF. Database Systems Lecture 11 Natasha Alechina

Chapter 10. Functional Dependencies and Normalization for Relational Databases. Copyright 2007 Ramez Elmasri and Shamkant B.

A. TRUE-FALSE: GROUP 2 PRACTICE EXAMPLES FOR THE REVIEW QUIZ:

Chapter 6. Database Tables & Normalization. The Need for Normalization. Database Tables & Normalization

Normalization. Normalization. Normalization. Data Redundancy

Functional Dependency and Normalization for Relational Databases

Chapter 5: FUNCTIONAL DEPENDENCIES AND NORMALIZATION FOR RELATIONAL DATABASES

Normalisation 6 TABLE OF CONTENTS LEARNING OUTCOMES

Unit 3.1. Normalisation 1 - V Normalisation 1. Dr Gordon Russell, Napier University

Database Management System

Chapter 9: Normalization

Normal forms and normalization

Database Design and Normal Forms

Fundamentals of Database System

RELATIONAL DATABASE DESIGN

Chapter 10. Functional Dependencies and Normalization for Relational Databases

Design of Relational Database Schemas

Normalisation 1. Chapter 4.1 V4.0. Napier University

Theory of Relational Database Design and Normalization

Announcements. SQL is hot! Facebook. Goal. Database Design Process. IT420: Database Management and Organization. Normalization (Chapter 3)

Module 5: Normalization of database tables

CS143 Notes: Normalization Theory

Normalization. CIS 3730 Designing and Managing Data. J.G. Zheng Fall 2010

C# Cname Ccity.. P1# Date1 Qnt1 P2# Date2 P9# Date9 1 Codd London Martin Paris Deen London

Chapter 10 Functional Dependencies and Normalization for Relational Databases

Introduction to normalization. Introduction to normalization

Normalization in Database Design

Database Design and Normalization


LOGICAL DATABASE DESIGN

Normalization. Normalization. First goal: to eliminate redundant data. for example, don t storing the same data in more than one table

Database Design. Marta Jakubowska-Sobczak IT/ADC based on slides prepared by Paula Figueiredo, IT/DB

Topic 5.1: Database Tables and Normalization

Theory of Relational Database Design and Normalization

Tutorial on Relational Database Design

DATABASE DESIGN: NORMALIZATION NOTE & EXERCISES (Up to 3NF)

DBMS. Normalization. Module Title?

Normalization. Reduces the liklihood of anomolies

RELATIONAL DATABASE DESIGN. Basic Concepts

Normalization. Functional Dependence. Normalization. Normalization. GIS Applications. Spring 2011

Schema Refinement, Functional Dependencies, Normalization

Determination of the normalization level of database schemas through equivalence classes of attributes

Databases -Normalization III. (N Spadaccini 2010 and W Liu 2012) Databases - Normalization III 1 / 31

CSCI-GA Database Systems Lecture 7: Schema Refinement and Normalization

BCA. Database Management System

Functional Dependencies and Finding a Minimal Cover

6.830 Lecture PS1 Due Next Time (Tuesday!) Lab 1 Out today start early! Relational Model Continued, and Schema Design and Normalization

SQL Server. 1. What is RDBMS?

Normalization. Purpose of normalization Data redundancy Update anomalies Functional dependency Process of normalization

Normalization in OODB Design

Part 6. Normalization

Bridge from Entity Relationship modeling to creating SQL databases, tables, & relations

Chapter 7: Relational Database Design

DATABASE MANAGEMENT SYSTEMS. Question Bank:

The process of database development. Logical model: relational DBMS. Relation

Week 11: Normal Forms. Logical Database Design. Normal Forms and Normalization. Examples of Redundancy

Introduction to Databases, Fall 2005 IT University of Copenhagen. Lecture 5: Normalization II; Database design case studies. September 26, 2005

Optimum Database Design: Using Normal Forms and Ensuring Data Integrity. by Patrick Crever, Relational Database Programmer, Synergex

Normalization of database model. Pazmany Peter Catholic University 2005 Zoltan Fodroczi

Normalization NORMALIZATION. Primary keys (contd.) Primary keys

Database Design and the Reality of Normalisation

Database Systems Concepts, Languages and Architectures

Limitations of E-R Designs. Relational Normalization Theory. Redundancy and Other Problems. Redundancy. Anomalies. Example

DATABASE DESIGN: Normalization Exercises & Answers

Normalisation. Why normalise? To improve (simplify) database design in order to. Avoid update problems Avoid redundancy Simplify update operations

Benefits of Normalisation in a Data Base - Part 1

RELATIONAL DATABASE DESIGN Good Database Design Principles

Relational Database Design

C HAPTER 4 INTRODUCTION. Relational Databases FILE VS. DATABASES FILE VS. DATABASES

Chapter 7: Relational Database Design

Introduction to Computing. Lectured by: Dr. Pham Tran Vu

normalisation Goals: Suppose we have a db scheme: is it good? define precise notions of the qualities of a relational database scheme

Database Design Methodology

Database Management Systems. Redundancy and Other Problems. Redundancy

Jordan University of Science & Technology Computer Science Department CS 728: Advanced Database Systems Midterm Exam First 2009/2010

Database Management Systems 2015

Data Dictionary and Normalization

Access Database Design

An Introduction to Relational Database Management System

Database Constraints and Design

14 Databases. Source: Foundations of Computer Science Cengage Learning. Objectives After studying this chapter, the student should be able to:

Functional Dependencies and Normalization

MODULE 8 LOGICAL DATABASE DESIGN. Contents. 2. LEARNING UNIT 1 Entity-relationship(E-R) modelling of data elements of an application.

Database Normalization as a By-product of Minimum Message Length Inference

2. Basic Relational Data Model

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

Teaching Database Modeling and Design: Areas of Confusion and Helpful Hints

Fundamentals of Database Design

Transcription:

Normalization of Database UNIT-4 Database Normalisation is a technique of organizing the data in the database. Normalization is a systematic approach of decomposing tables to eliminate data redundancy and undesirable characteristics like Insertion, Update and Deletion Anamolies. It is a multi-step process that puts data into tabular form by removing duplicated data from the relation tables. Normalization is used for mainly two purpose, Eliminating reduntant(useless) data. Ensuring data dependencies make sense i.e data is logically stored. Problem Without Normalization Without Normalization, it becomes difficult to handle and update the database, without facing data loss. Insertion, Updation and Deletion Anamolies are very frequent if Database is not Normalized. To understand these anomalies let us take an example of Student table. S_id S_Name S_Address Subject_opted 401 Adam Noida Bio 402 Alex Panipat Maths 403 Stuart Jammu Maths 404 Adam Noida Physics 142

Updation Anamoly : To update address of a student who occurs twice or more than twice in a table, we will have to update S_Address column in all the rows, else data will become inconsistent. Insertion Anamoly : Suppose for a new admission, we have a Student id(s_id), name and address of a student but if student has not opted for any subjects yet then we have to insert NULL there, leading to Insertion Anamoly. Deletion Anamoly : If (S_id) 401 has only one subject and temporarily he drops it, when we delete that row, entire student record will be deleted along with it. Normalization Rule Normalization rule are divided into following normal form. 1. First Normal Form 2. Second Normal Form 3. Third Normal Form 4. BCNF First Normal Form (1NF) As per First Normal Form, no two Rows of data must contain repeating group of information i.e each set of column must have a unique value, such that multiple columns cannot be used to fetch the same row. Each table should be organized into rows, and each row should have a primary key that distinguishes it as unique. The Primary key is usually a single column, but sometimes more than one column can be combined to create a single primary key. For example consider a table which is not in First normal form Student Table : Student Age Subject 143

Adam 15 Biology, Maths Alex 14 Maths Stuart 17 Maths In First Normal Form, any row must not have a column in which more than one value is saved, like separated with commas. Rather than that, we must separate such data into multiple rows. Student Table following 1NF will be : Student Age Subject Adam 15 Biology Adam 15 Maths Alex 14 Maths Stuart 17 Maths Using the First Normal Form, data redundancy increases, as there will be many columns with same data in multiple rows but each row as a whole will be unique. Second Normal Form (2NF) As per the Second Normal Form there must not be any partial dependency of any column on primary key. It means that for a table that has concatenated primary key, each column in the table that is not part of the primary key must depend upon the entire concatenated key for its existence. If any column depends only on one part of the concatenated key, then the table fails Second normal form. 144

In example of First Normal Form there are two rows for Adam, to include multiple subjects that he has opted for. While this is searchable, and follows First normal form, it is an inefficient use of space. Also in the above Table in First Normal Form, while the candidate key is {Student, Subject}, Age of Student only depends on Student column, which is incorrect as per Second Normal Form. To achieve second normal form, it would be helpful to split out the subjects into an independent table, and match them up using the student names as foreign keys. New Student Table following 2NF will be : Student Age Adam 15 Alex 14 Stuart 17 In Student Table the candidate key will be Student column, because all other column i.e Age is dependent on it. New Subject Table introduced for 2NF will be : Student Subject Adam Biology Adam Maths Alex Maths Stuart Maths 145

In Subject Table the candidate key will be {Student, Subject} column. Now, both the above tables qualifies for Second Normal Form and will never suffer from Update Anomalies. Although there are a few complex cases in which table in Second Normal Form suffers Update Anomalies, and to handle those scenarios Third Normal Form is there. Third Normal Form (3NF) Third Normal form applies that every non-prime attribute of table must be dependent on primary key, or we can say that, there should not be the case that a non-prime attribute is determined by another non-prime attribute. So this transitive functional dependency should be removed from the table and also the table must be in Second Normal form. For example, consider a table with following fields. Student_Detail Table : Student_id Student_name DOB Street city State Zip In this table Student_id is Primary key, but street, city and state depends upon Zip. The dependency between zip and other fields is called transitive dependency. Hence to apply 3NF, we need to move the street, city and state to new table, with Zip as primary key. New Student_Detail Table : Student_id Student_name DOB Zip Address Table : Zip Street city state The advantage of removing transtive dependency is, Amount of data duplication is reduced. Data integrity achieved. 146

Boyce and Codd Normal Form (BCNF) Boyce and Codd Normal Form is a higher version of the Third Normal form. This form deals with certain type of anamoly that is not handled by 3NF. A 3NF table which does not have multiple overlapping candidate keys is said to be in BCNF. For a table to be in BCNF, following conditions must be satisfied: R must be in 3rd Normal Form and, for each functional dependency ( X -> Y ), X should be a super Key. FOURTH NORMAL FORM Fourth normal form (4NF) is a level of database normalization where there are no non-trivial multivalued dependencies other than a candidate key. It builds on the first three normal forms (1NF, 2NF and 3NF) and the Boyce-Codd Normal Form (BCNF). It states that, in addition to a database meeting the requirements of BCNF, it must not contain more than one multivalued dependency. 147