Schema Normalization. 30 th August Submitted By: Saurabh Singla Rahul Bhatnagar

Similar documents
Normalization. Murali Mani. What and Why Normalization? To remove potential redundancy in design

Homework 3: Relational Database Design Theory (100 points)

Midterm Exam #1 Version A CS 122A Winter 2017

More Normalization Algorithms. CS157A Chris Pollett Nov. 28, 2005.

Techno India Batanagar Computer Science and Engineering. Model Questions. Subject Name: Database Management System Subject Code: CS 601

FUNCTIONAL DEPENDENCIES

Chapter 16. Relational Database Design Algorithms. Database Design Approaches. Top-Down Design

Redundancy:Dependencies between attributes within a relation cause redundancy.

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

Chapter 10. Chapter Outline. Chapter Outline. Functional Dependencies and Normalization for Relational Databases

Example Examination. Allocated Time: 100 minutes Maximum Points: 250

MIDTERM EXAMINATION Spring 2010 CS403- Database Management Systems (Session - 4) Ref No: Time: 60 min Marks: 38

Database Design Theory and Normalization. CS 377: Database Systems

Chapter 10. Normalization. Chapter Outline. Chapter Outline(contd.)

Database Management

Functional dependency theory

Normalisation theory

Theory of Normal Forms Decomposition of Relations. Overview

Normalisation. Normalisation. Normalisation

Functional Dependencies and. Databases. 1 Informal Design Guidelines for Relational Databases. 4 General Normal Form Definitions (For Multiple Keys)

Chapter 14 Outline. Normalization for Relational Databases: Outline. Chapter 14: Basics of Functional Dependencies and

Elmasri/Navathe, Fundamentals of Database Systems, Fourth Edition Chapter 10-2

Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications. Overview - detailed. Goal. Faloutsos & Pavlo CMU SCS /615

Relational Database Design (II)

Chapter 14. Database Design Theory: Introduction to Normalization Using Functional and Multivalued Dependencies

CMU SCS CMU SCS CMU SCS CMU SCS whole nothing but

Handout 3: Functional Dependencies and Normalization

Databases Lecture 7. Timothy G. Griffin. Computer Laboratory University of Cambridge, UK. Databases, Lent 2009

CSIT5300: Advanced Database Systems

UNIT 3 DATABASE DESIGN

Mapping ER Diagrams to. Relations (Cont d) Mapping ER Diagrams to. Exercise. Relations. Mapping ER Diagrams to Relations (Cont d) Exercise

A7-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Winter 2009 Lecture 4 - Schema Normalization

Database Management System Prof. Partha Pratim Das Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Informal Design Guidelines for Relational Databases

DATABASE MANAGEMENT SYSTEMS

Chapter 8: Relational Database Design

Functional Dependencies and Normalization for Relational Databases Design & Analysis of Database Systems

Relational Design 1 / 34

Database Systems CSE Comprehensive Exam Spring 2005

Midterm Exam (Version B) CS 122A Spring 2017

Unit 3 : Relational Database Design

Steps in normalisation. Steps in normalisation 7/15/2014

Fundamentals of Database Systems

CS403- Database Management Systems Solved Objective Midterm Papers For Preparation of Midterm Exam

Birkbeck. (University of London) BSc/FD EXAMINATION. Department of Computer Science and Information Systems. Database Management (COIY028H6)

Schema Refinement: Dependencies and Normal Forms

The University of Nottingham

7+8+9: Functional Dependencies and Normalization

Lecture #8 (Still More Relational Theory...!)

Schema Refinement: Dependencies and Normal Forms

Final Review. Zaki Malik November 20, 2008

The University of British Columbia

Schema Refinement & Normalization Theory 2. Week 15

Schema Refinement: Dependencies and Normal Forms

V. Database Design CS448/ How to obtain a good relational database schema

Review: Attribute closure

Case Study: Lufthansa Cargo Database

Lecture 11 - Chapter 8 Relational Database Design Part 1

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2009 Lecture 3 - Schema Normalization

DATABASTEKNIK - 1DL116

Normalisation Chapter2 Contents

CS403- Database Management Systems Solved MCQS From Midterm Papers. CS403- Database Management Systems MIDTERM EXAMINATION - Spring 2010

Part II: Using FD Theory to do Database Design

Draw A Relational Schema And Diagram The Functional Dependencies In The Relation >>>CLICK HERE<<<

Midterm Exam #1 Version B CS 122A Winter 2017

Functional Dependencies and Single Valued Normalization (Up to BCNF)

Relational Database design. Slides By: Shree Jaswal

In This Lecture. Normalisation to BCNF. Lossless decomposition. Normalisation so Far. Relational algebra reminder: product

CS 338 Functional Dependencies

Solutions to Final Examination

CSCI 403: Databases 13 - Functional Dependencies and Normalization

Normalization Rule. First Normal Form (1NF) Normalization rule are divided into following normal form. 1. First Normal Form. 2. Second Normal Form

Attach extra pages as needed. Write your name and ID on any extra page that you attach. Please, write neatly.

Functional Dependency

Functional Dependencies CS 1270

customer = (customer_id, _ customer_name, customer_street,

Database design III. Quiz time! Using FDs to detect anomalies. Decomposition. Decomposition. Boyce-Codd Normal Form 11/4/16

Chapter 6: Relational Database Design

CSE 562 Database Systems

Lectures 12: Design Theory I. 1. Normal forms & functional dependencies 2/19/2018. Today s Lecture. What you will learn about in this section

The University of British Columbia

DATABASE MANAGEMENT SYSTEM SHORT QUESTIONS. QUESTION 1: What is database?

COSC Dr. Ramon Lawrence. Emp Relation

Chapter 14. Chapter 14 - Objectives. Purpose of Normalization. Purpose of Normalization

CS 2451 Database Systems: Database and Schema Design

Relational Database Design. Announcements. Database (schema) design. CPS 216 Advanced Database Systems. DB2 accounts have been set up

The Relational Data Model

Databases Tutorial. March,15,2012 Jing Chen Mcmaster University

Name :. Roll No. :... Invigilator s Signature : DATABASE MANAGEMENT SYSTEM

Relational Design Theory. Relational Design Theory. Example. Example. A badly designed schema can result in several anomalies.

Last Name: Doe First Name: John Student ID:

The Relational Model and Normalization

EECS 647: Introduction to Database Systems

Schema Refinement and Normal Forms

ItemInShop(ShopID, address, suburb, postcode, phonenumber, itemid, description, price, quantityinstock)

Homework 6: FDs, NFs and XML (due April 13 th, 2016, 4:00pm, hard-copy in-class please)

Homework 6: FDs, NFs and XML (due April 15 th, 2015, 4:00pm, hard-copy in-class please)

COMP7640 Assignment 2

Introduction to Data Management. Lecture #11 (Relational Languages I)

Transcription:

Schema Normalization 30 th August 2011 Submitted By: Saurabh Singla 09010146 Rahul Bhatnagar 09010136

Normalization Consider the following ER diagram with some FD: Instructor iid A Student sid Department did Here FD s are: iid did sid, did iid For A schema is iid, sid, did, with (sid, did) as its key A is in 1 st NF as all the attributes are atomic A is in 2 nd NF A is in 3 rd NF A is not in BCNF due to the dependency iid did For converting A to BCNF we decompose A into 2 tables (R1 and R2): R1 s schema (sid, iid) with both attributes as key. R2 s schema (iid, did) with iid as primary key.

R1 and R2 both are in BCNF as there are only two attributes in each of the decomposed table This decomposition is Lossless Decomposition as R1 R2 = iid. And iid is the key for R2 But this Decomposition is not Dependency Preserving as the FD sid, did iid is lost. Consider a Table Student with attributes sid, sname, vid, vcolor where: (sid forms the key for the table) sid represents student_id sname represents student s name vid represents vehicle_id, vehicle is owned by students vcolor represents color of the vehicle owned by the student Student sid, sname, vid, vcolor Now consider different situations: 1. Students don t share vehicle and every student has only one. In this case the FD s are: 1. sid vid 2. vid sid

3. sid sname 4. vid vcolor Table is in 2 nd NF as there is only one attribute in candidate key. It is not in 3 rd NF due to dependency 4 as vcolor is not part of candidate key. So it is also not in BCNF as not in 3 rd NF 2. Now Let Students share Vehicle. In this Case all the FD that are in Case 1 hold except vid sid. Table is in 2nd NF as there is only one attribute in candidate key. It is not in 3rd NF due to dependency 4 as vcolor is not part of candidate key. So it is also not in BCNF as not in 3rd NF. So we decompose Student table into 2 tables Student and Vehicle. Student Scheme is (sid, sname, vid) with key sid and vid as foreign key to Vehicle table. Vehicle Schema is (vid, vcolor) with key as vcolor. o Vehicle is in BCNF as only two attributes. o Student is also in BCNF as only dependency for student is either trivial and the others are sid implied and sid is only the key for the table. o Decomposition is Lossless as student vehicle = vid and vid is key for vehicle table. o It is not dependency preserving decomposition as dependency sid vcolor is lost. 3. Students can have multiple vehicles and vehicles can be shared between students.

Consider the two tables student and vehicle created in previous case, FD s for vehicle table remains same, but the FD s for student table changes. Also Candidate key for student table now becomes sid, vid. In this case the FD s for student table are: 1. sid, vid sname 2. sid sname Vehicle Table is in BCNF as only two attributes. Student Table is in 1 st NF, But not in 2 nd NF and so not in 3 rd NF and BCNF. Table not in 2 nd NF because of FD: o sid sname as sname is not a part of candidate key for student table and depends on sid, which is proper subset of candidate key for student table. To attain higher NF s for student table decompose student table further into two tables: Student1 with schema (sid, sname) and sid as its key. Student2 with schema (sid, vid) and both attributes as key, i.e. vid, sid together form candidate key for student2. Now Student1, Student2, Vehicle all three tables have only two attributes each which ultimately make them in BCNF. Originally the ER diagram for above problem must be as follows: Student sid, sname Owns Vehicle vid, vcolor

While converting ER diagrams to relational model some information is always lost, as from the above ER diagram it is clear that for vehicle table their must be full participation in the relation owns, but in relation model tables we created there is no such information, but if we do ER modeling Properly and convert ER diagrams to relational tables properly, there will be no need for decomposition s to be done to attain the NF s.