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



Similar documents
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases

Theory of Relational Database Design and Normalization

Chapter 10 Functional Dependencies and Normalization for Relational Databases

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

Functional Dependency and Normalization for Relational Databases

Chapter 10. Functional Dependencies and Normalization for Relational Databases

Theory of Relational Database Design and Normalization

LiTH, Tekniska högskolan vid Linköpings universitet 1(7) IDA, Institutionen för datavetenskap Juha Takkinen

Relational Database Design

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

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

Database Design and Normalization

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

Relational Database Design Theory

Functional Dependencies

MCQs~Databases~Relational Model and Normalization

Chapter 5: FUNCTIONAL DEPENDENCIES AND NORMALIZATION FOR RELATIONAL DATABASES

Schema Refinement, Functional Dependencies, Normalization

Normalization in Database Design

RELATIONAL DATABASE DESIGN

Functional Dependencies and Finding a Minimal Cover

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

Fundamentals of Database System

DATABASE NORMALIZATION

CS2Bh: Current Technologies. Introduction to XML and Relational Databases. The Relational Model. The relational model

Database Management System

Normalization of Database

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

Database Design and Normal Forms

DATABASE MANAGEMENT SYSTEMS. Question Bank:

CS143 Notes: Normalization Theory

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

DATABASE SYSTEMS. Chapter 7 Normalisation

Why Is This Important? Schema Refinement and Normal Forms. The Evils of Redundancy. Functional Dependencies (FDs) Example (Contd.)

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

Schema Design and Normal Forms Sid Name Level Rating Wage Hours

Normalization in OODB Design

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

Chapter 7: Relational Database Design

Chapter 7: Relational Database Design

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

Normalisation 6 TABLE OF CONTENTS LEARNING OUTCOMES

Lecture 2 Normalization

BCA. Database Management System

Introduction to Database Systems. Normalization

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

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

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

Database Systems Concepts, Languages and Architectures

Normalization. CIS 331: Introduction to Database Systems

Relational Normalization: Contents. Relational Database Design: Rationale. Relational Database Design. Motivation

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

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

Design of Relational Database Schemas

Database Constraints and Design

Normalization. Normalization. Normalization. Data Redundancy

Schema Refinement and Normalization

Normal forms and normalization

Figure 14.1 Simplified version of the

Relational Database Design: FD s & BCNF

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

Objectives, outcomes, and key concepts. Objectives: give an overview of the normal forms and their benefits and problems.

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

Databases What the Specification Says

Chapter 8. Database Design II: Relational Normalization Theory

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

Chapter 9: Normalization

Database Design Overview. Conceptual Design ER Model. Entities and Entity Sets. Entity Set Representation. Keys

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

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

LOGICAL DATABASE DESIGN

Lecture Notes on Database Normalization

Relational model. Relational model - practice. Relational Database Definitions 9/27/11. Relational model. Relational Database: Terminology

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

Introduction to normalization. Introduction to normalization

Normalisation to 3NF. Database Systems Lecture 11 Natasha Alechina

The Relational Data Model and Relational Database Constraints

Database Design and the Reality of Normalisation

Module 5: Normalization of database tables

Database Management Systems. Redundancy and Other Problems. Redundancy

The Relational Model. Why Study the Relational Model? Relational Database: Definitions

Scheme G. Sample Test Paper-I

Functional Dependencies and Normalization

Limitations of DB Design Processes

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

CSC 742 Database Management Systems

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

Database Design Methodologies

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

DBMS. Normalization. Module Title?

Normalization for Relational DBs

Part 6. Normalization

Database Management Systems 2015

SQL Server. 1. What is RDBMS?

Physical Database Design and Tuning

1. Physical Database Design in Relational Databases (1)

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

IT2305 Database Systems I (Compulsory)

Transcription:

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

Relational database design So far Conceptual database design - ER Model Logical database design - relational model Mapping from ER to Relational Model Relational Algebra SQL Relational database design - relational model goodness measures of relational schemas 2

3

Some Bad Designs

Insert Anomaly: Anomalies an insert operation that insert ONE item of information needs to insert multiple tuples into some relation or needs to use NULL values Delete Anomaly: a delete operation that delete ONE item of information needs to delete multiple tuples from some relation or cause "additional" (unintended) information loss Update Anomaly: an update operation that update ONE item of information needs to update multiple tuples and may result in logical inconsistencies 6

Generation of Spurious Tuples Figure 15.5(a) Relation schemas EMP_LOCS and EMP_PROJ1 NATURAL JOIN Result produces many more tuples than the original set of tuples in EMP_PROJ Called spurious tuples Represent spurious information that is not valid 9

Problematic Designs Anomalies cause redundant work to be done Waste of storage space due to NULLs Difficulty of performing operations and joins due to NULL values Generation of invalid and spurious data during joins 10

Informal Design Guidelines for Good Relation Schemas Clear schema and attribute semantics No insertion, deletion, or update anomalies are present Reducing redundant information in tuples Reducing NULL values in tuples Can be joined with equality conditions on related attributes with guarantees that no spurious tuples are generated 11

Normal forms Database Design Theory Each Normal Form defines a set of properties that relations must satisfy When relations possess these properties, they exhibit less anomalies Successively higher degrees of stringency Database normalization Certify whether a database design satisfies a certain normal form Correct a database design to achieve certain normal form Additional properties Nonadditive join property Dependency preservation property 12

History Relational database model 1970, Codd 1NF, 2NF and 3NF (first, second, and third normal form) 1972, Codd Based on the concept of functional dependency BCNF (Boyce-Codd Normal Form) 4NF 1974, Boyce & Codd new and stronger 3NF 1977, Fagin multi-valued dependencies 5NF (projection-join normal form) 1979, Fagin 13

First Normal Form Part of the formal definition of a relation in the basic (flat) relational model Only attribute values permitted are single atomic (or indivisible) values Techniques to achieve first normal form Remove attribute violating 1NF and place in separate relation Expand the key Use several atomic attributes if maximum number of values is known 14

15

Functional Dependency Constraint between two sets of attributes X functionally determines Y Y is functionally dependent on X Notes If X is a candidate key of R, then X R If X Y, not necessarily Y X 16

Example FDs

Example FDs

Functional Dependency An FD is a property of semantics or meaning of the attributes An FD is a property of the relational schema, not of a particular legal relation state An FD must be defined based on the semantics of the attributes An FD cannot be inferred automatically from a given populated relation An FD may exist Can state that an FD does not hold if there are violations of such an FD 19

Definitions of Keys and Attributes Participating in Keys Definition of superkey and key Candidate key If more than one key in a relation schema One is primary key Others are secondary keys 20

Second Normal Form Full functional dependency vs. Partial functional dependency X Y is a full functional dependency if for any A, (X- {A}) does not functionally determine Y X Y is a partial functional dependency if for some A, (X-{A}) functionally determines Y Second normal form (2NF) Problematic FD Left-hand side is part of primary key 21

Third Normal Form Transitive dependency X Y is a transitive dependency if for some Z that is not a prime attribute, both X Z and Z Y hold Third normal form Problematic FD Left-hand side is part of primary key Left-hand side is a nonkey attribute 24

Summary 27

28

29

30

BCNF Boyce-Codd Normal Form Difference from 3NF: 3NF allows A to be prime Every relation in BCNF is also in 3NF Most relation schemas that are in 3NF are also in BCNF but not all: 31

32

33

Summary Informal guidelines for good design Functional dependency Normal forms 1NF, 2NF, 3NF, BCNF 34