Relational Database Design Theory



Similar documents
Theory of Relational Database Design and Normalization

Chapter 10. Functional Dependencies and Normalization for Relational Databases

Database Design and Normalization

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

Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases

Design of Relational Database Schemas

Relational Database Design

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

Functional Dependency and Normalization for Relational Databases

Database Management System

Schema Refinement, Functional Dependencies, Normalization

Schema Refinement and Normalization

Database Design and Normal Forms

Chapter 5: FUNCTIONAL DEPENDENCIES AND NORMALIZATION FOR RELATIONAL DATABASES

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

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

Database Management Systems. Redundancy and Other Problems. Redundancy

Lecture Notes on Database Normalization

Theory behind Normalization & DB Design. Satisfiability: Does an FD hold? Lecture 12

Schema Design and Normal Forms Sid Name Level Rating Wage Hours

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

Figure 14.1 Simplified version of the

Relational Database Design: FD s & BCNF

Functional Dependencies and Normalization

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

Normalization for Relational DBs

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

Design Theory for Relational Databases: Functional Dependencies and Normalization

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

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

Boyce-Codd Normal Form

Chapter 7: Relational Database Design

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

Normalisation to 3NF. Database Systems Lecture 11 Natasha Alechina

Introduction to Database Systems. Normalization

Functional Dependencies and Finding a Minimal Cover

Advanced Relational Database Design

CS143 Notes: Normalization Theory

Functional Dependencies

Chapter 8. Database Design II: Relational Normalization Theory

Normalization in Database Design

Chapter 7: Relational Database Design

Limitations of DB Design Processes

Normalization. CIS 331: Introduction to Database Systems

Objectives of Database Design Functional Dependencies 1st Normal Form Decomposition Boyce-Codd Normal Form 3rd Normal Form Multivalue Dependencies

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

Introduction Decomposition Simple Synthesis Bernstein Synthesis and Beyond. 6. Normalization. Stéphane Bressan. January 28, 2015

Normalization in OODB Design

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

SQL DDL. DBS Database Systems Designing Relational Databases. Inclusion Constraints. Key Constraints

3. Database Design Functional Dependency Introduction Value in design Initial state Aims

Database Design and Normalization

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

RELATIONAL DATABASE DESIGN

Relational Normalization Theory (supplemental material)

DATABASE NORMALIZATION

10CS54: DATABASE MANAGEMENT SYSTEM

Normalisation and Data Storage Devices

Normalisation in the Presence of Lists

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

Database Systems Concepts, Languages and Architectures

Introduction to Database Systems. Chapter 4 Normal Forms in the Relational Model. Chapter 4 Normal Forms

Normal forms and normalization

Quiz 3: Database Systems I Instructor: Hassan Khosravi Spring 2012 CMPT 354

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

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

A Web-Based Environment for Learning Normalization of Relational Database Schemata

DATABASE SYSTEMS. Chapter 7 Normalisation

Database Constraints and Design

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

Scheme G. Sample Test Paper-I

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

An Algorithmic Approach to Database Normalization

Lecture 2 Normalization

Database Sample Examination

Lecture 6. SQL, Logical DB Design

Normalization. Normalization. Normalization. Data Redundancy

DATABASE MANAGEMENT SYSTEMS. Question Bank:

Graham Kemp (telephone , room 6475 EDIT) The examiner will visit the exam room at 15:00 and 17:00.

Normalization of Database

TYPICAL QUESTIONS & ANSWERS

BCA. Database Management System

1. A table design is shown which violates 1NF. Give a design which will store the same information but which is in 1NF.

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

Introduction to Databases

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

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

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

DATABASE DESIGN: Normalization Exercises & Answers

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

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

The Relational Model. Ramakrishnan&Gehrke, Chapter 3 CS4320 1

To identify entities and their relationships. To describe entities using attributes, multivalued attributes, derived attributes, and key attributes.

B2.2-R3: INTRODUCTION TO DATABASE MANAGEMENT SYSTEMS

Transcription:

Relational Database Design Theory Informal guidelines for good relational designs Functional dependencies Normal forms and normalization 1NF, 2NF, 3NF BCNF, 4NF, 5NF Inference rules on functional dependencies Additional properties for relational decompositions Nonadditive join property Dependency preservation property 31

2NF, 3NF 2NF 3NF 32

33

34

35

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

37

38

1NF, 2NF, 3NF, BCNF Test on any nontrivial X A Violations normalization 1NF Multi-valued attributes New relation for each multi-valued attributes 2NF 3NF a) X is a super key or b) X is not a key or c) A is a key attribute a) X is a super key or c) A is a key attribute 1) partial key -> non-key attribute (partial FD) 1) or 2) Non-key attribute -> nonkey attribute (transitive FD) BCNF a) X is a super key 1) or 2) or 3) non-key -> key attribute New relation for the partial key and its dependent attributes Above and New relation for the non-key attribute and its dependent attributes Above and New relation for the non-key attribute and its dependent attributes 39

Relational Database Design Theory Informal guidelines for good relational designs Functional dependencies Normal forms and normalization 1NF, 2NF, 3NF BCNF, 4NF, 5NF Functional dependencies and keys Additional properties for relational decompositions Nonadditive join property Dependency preservation property 40

Keys and Functional Superkey Dependencies No two distinct tuples in any state r of R can have the same value for SK Functional dependency: SK R Key Superkey of R; and it is minimal (removing any attribute A from K leaves a set of attributes that is not a superkey any more) Functional dependency: K R, and for any A in K, K- {A} R does not hold Given a set of functional dependencies, can we find the keys of R? 41

Inference Rules for FDs Armstrong s inference rules (complete) Reflexivity rule: ify XthenX Y Augmentation rule: ifx YthenXZ YZ Transitivity rule: ifx YandY ZthenX Z Other rules Decomposition Rule: ifx YZ then: X Y and X Z Union or Additive Rule: ifx YandX Zthen: X YZ Pseudfotransitive Rule: ifx YandYW Zthen: XW Z 42

Inference Rules for FDs Specify a set of FDs that can be easily determined from attribute semantics Infer additional FDs using inference rules The closure of a FD set F the set of all FDs that include F as well as all FDs that can be inferred from F 43

Closure of attribute set The closure of attribute set X under FD set F, denoted as X+ The set of attributes that are functionally determined by X based on F How can we computationally find X+ How can we determine a set of attributes X is a key? 44

Example SSN + Dnumber + {SSN, Dnumber} + {SSN, Dnumber, Ename} + 46

Example SSN + = {SSN, Ename, Bdate, Address, Dnumber, Dname, Dmgr_ssn} Dnumber + = {Dnumber, Dname, Dmgr_ssn} {SSN, Dnumber} + = {SSN, Ename, Bdate, Address, Dnumber, Dname, Dmgr_ssn} {SSN, Dnumber, Ename} + = {SSN, Ename, Bdate, Address, Dnumber, Dname, Dmgr_ssn} Which of these attribute sets are superkeys? Keys? 47

Finding Keys based on Attribute Closure If X + = R, then X is a superkey If X + = R, and (X-{A}) +!= R, then X is a key How do we find all keys given a FD set F? How do we find one key given a FD set F? 48

Example Initialization K = {SSN, Ename, Bdate, Address, Dnumber, Dname, Dmgr_ssn} Decrease one attribute at a time K = {SSN, Dnumber} 50

Relational Database Design Theory Informal guidelines for good relational designs Functional dependencies Normal forms and normalization 1NF, 2NF, 3NF BCNF, 4NF, 5NF Functional dependencies and keys Additional properties for relational decompositions Nonadditive join property Dependency preservation property 51

Dependency Preservation Property Informally, given a decomposition D of R and a FD set F on R, each FD in F either appear directly in D or could be inferred Claim 1. it is always possible to find a dependency- preserving decomposition D with respect to F such that each relation Ri in D is in 3NF 52

Non-additive Join Property A decomposition D = {R1, R2,..., Rm} of R has the lossless (nonadditive) join property with respect to the set of FDs F on R if, for every legal relation state r, the following holds, where * is the natural join of all the relations in D: * (ππ R1 (r),..., π Rm (r)) = r lossless for loss of information, i.e. addition of spurious information How to test whether a decomposition satisfies the lossless join property? 53

Successive Lossless Join Decomposition Claim 2 (Preservation of non-additivity in successive decompositions): If a decomposition D = {R1, R2,..., Rm} of R has the lossless (non-additive) join property with respect to F and if a decomposition Di = {Q1, Q2,..., Qk} of Ri has the lossless (non-additive) join property with respect to the projection of F then the decomposition D2 = {R1, R2,..., Ri-1, Q1, Q2,..., Qk, Ri+1,..., Rm} of R has the non-additive join property with respect to F. 60

Normalization with BCNF and Lossless Join Property

In Practice Relational design from ER model or existing tables/reports Normalization for 3NF or BCNF with lossless join property Sometimes normal forms are violated deliberately to achieve better performance (less join operations) 62