FUNCTIONAL DEPENDENCIES CHAPTER , 15.5 (6/E) CHAPTER , 10.5 (5/E)

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

Copyright 2016 Ramez Elmasri and Shamkant B. Navathe

CS 338 Functional Dependencies

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

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

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

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

Informal Design Guidelines for Relational Databases

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

Guideline 1: Semantic of the relation attributes Do not mix attributes from distinct real world. example

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

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

UNIT 3 DATABASE DESIGN

Dr. Anis Koubaa. Advanced Databases SE487. Prince Sultan University

Relational Database design. Slides By: Shree Jaswal

Relational Design 1 / 34

BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E)

Functional Dependencies & Normalization for Relational DBs. Truong Tuan Anh CSE-HCMUT

The strategy for achieving a good design is to decompose a badly designed relation appropriately.

BASIC SQL CHAPTER 4 (6/E) CHAPTER 8 (5/E)

Database Design Theory and Normalization. CS 377: Database Systems

TDDD12 Databasteknik Föreläsning 4: Normalisering

CMP-3440 Database Systems

CS 2451 Database Systems: Database and Schema Design

In Chapters 3 through 6, we presented various aspects

CONSTRAINTS AND UPDATES CHAPTER 3 (6/E) CHAPTER 5 (5/E)

MODULE: 3 FUNCTIONAL DEPENDENCIES

Lecture5 Functional Dependencies and Normalization for Relational Databases

DATABASES AND DATABASE USERS CHAPTER 1

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

Relational Model. CS 377: Database Systems

COSC Dr. Ramon Lawrence. Emp Relation

A database can be modeled as: + a collection of entities, + a set of relationships among entities.

We shall represent a relation as a table with columns and rows. Each column of the table has a name, or attribute. Each row is called a tuple.

Unit IV. S_id S_Name S_Address Subject_opted

Lecture 11 - Chapter 8 Relational Database Design Part 1

Exam I Computer Science 420 Dr. St. John Lehman College City University of New York 12 March 2002

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

More Relational Algebra

Schema Refinement: Dependencies and Normal Forms

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

CSE 562 Database Systems

FUNCTIONAL DEPENDENCIES

NORMALISATION (Relational Database Schema Design Revisited)

Schema Refinement: Dependencies and Normal Forms

Relational Design: Characteristics of Well-designed DB

CONSTRAINTS AND UPDATES CHAPTER 3 (6/E) CHAPTER 5 (5/E)

Schema Refinement: Dependencies and Normal Forms

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

DATABASE DESIGN I - 1DL300

The Relational Model

Functional Dependencies and Normal Forms

CSCI 403: Databases 13 - Functional Dependencies and Normalization

COSC344 Database Theory and Applications. σ a= c (P) S. Lecture 4 Relational algebra. π A, P X Q. COSC344 Lecture 4 1

IS 263 Database Concepts

Case Study: Lufthansa Cargo Database

Design Theory for Relational Databases

This lecture. Databases -Normalization I. Repeating Data. Redundancy. This lecture introduces normal forms, decomposition and normalization.

Relational Data Model. Christopher Simpkins

The Relational Data Model

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

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

Relational Model History. COSC 304 Introduction to Database Systems. Relational Model and Algebra. Relational Model Definitions.

The Relational Data Model and Relational Database Constraints

Functional Dependencies, Normalization. Rose-Hulman Institute of Technology Curt Clifton

DC62 Database management system JUNE 2013

NORMAL FORMS. CS121: Relational Databases Fall 2017 Lecture 18

Databases -Normalization I. (GF Royle, N Spadaccini ) Databases - Normalization I 1 / 24

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

Refresher: ER-modeling, logical relational model, dependencies. Toon Calders

CMU SCS CMU SCS CMU SCS CMU SCS whole nothing but

CS411 Database Systems. 05: Relational Schema Design Ch , except and

Functional Dependencies and Normal Forms

Part II: Using FD Theory to do Database Design

Database Management System (15ECSC208) UNIT I: Chapter 2: Relational Data Model and Relational Algebra

Final Review. Zaki Malik November 20, 2008

Ryan Marcotte CS 475 (Advanced Topics in Databases) March 14, 2011

QUESTION BANK. SUBJECT CODE / Name: CS2255 DATABASE MANAGEMENT SYSTEM UNIT III. PART -A (2 Marks)

The Relational Model

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

CS 377 Database Systems

EGCI 321: Database Systems. Dr. Tanasanee Phienthrakul

Relational Model. IT 5101 Introduction to Database Systems. J.G. Zheng Fall 2011

Introduction to Databases, Fall 2003 IT University of Copenhagen. Lecture 4: Normalization. September 16, Lecturer: Rasmus Pagh

CSIT5300: Advanced Database Systems

Redundancy:Dependencies between attributes within a relation cause redundancy.

ECE 650 Systems Programming & Engineering. Spring 2018

Databases The theory of relational database design Lectures for m

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

Introduction to Database Design, fall 2011 IT University of Copenhagen. Normalization. Rasmus Pagh

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

The Relational Model and Normalization

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

01/01/2017. Chapter 5: The Relational Data Model and Relational Database Constraints: Outline. Chapter 5: Relational Database Constraints

Chapter 5. The Relational Data Model and Relational Database Constraints. Slide 5-١. Copyright 2007 Ramez Elmasri and Shamkant B.

Copyright 2007 Ramez Elmasri and Shamkant B. Navathe. Slide 5-1

CS530 Database Architecture Models. Database Model. Prof. Ian HORROCKS. Dr. Robert STEVENS. and Design The Relational

Applied Databases. Sebastian Maneth. Lecture 5 ER Model, Normal Forms. University of Edinburgh - January 30 th, 2017

DC62 DATABASE MANAGEMENT SYSTEMS DEC 2013

Database Technology. Topic 2: Relational Databases and SQL. Olaf Hartig.

Transcription:

FUNCTIONAL DEPENDENCIES CHAPTER 15.1-15.2, 15.5 (6/E) CHAPTER 10.1-10.2, 10.5 (5/E)

4 LECTURE OUTLINE Design guidelines for relation schemas Functional dependencies Definition and interpretation Formal definition of keys Boyce-Codd Normal Form (BCNF) Application of dependency theory to checking DB design

5 GOODNESS IN RELATIONAL DESIGN Clarity of attributes provides semantics for relation schema Naming of attributes Fit of attributes with each other How can we measure how well attributes fit together? Amount of redundant information in tuples Amount of NULL values in tuples Possibility of generating spurious tuples

6 MIS-PACKAGED ATTRIBUTES Every tuple includes employee data and department data Redundancy Dname and Dmgr_ssn repeated for every employee in a department Potential for too many NULL values Departments with no employees need to pad tuple with NULLs Employees not in any department need to pad tuples with NULLs Update anomalies Deleting the last employee in a department should not delete the department Changing the department name or manager requires many tuples to be updated Inserting employees requires checking for consistency of its department name and manager

7 DESIGN GUIDELINES Guideline 1: Design each relation schema so that it is easy to explain its meaning Natural result of good ER design Do not arbitrarily combine attributes from multiple entity types and relationship types into a single relation Guideline 2: Design relational DB schema so that every fact can be stored in one and only one tuple

9 SIMPLE DEPENDENCIES Actor name birth city Ben Affleck 1972 Berkeley Alan Arkin 1934 New York Assume that no two actors have the same name Each actor has a unique date and city of birth Tommy Lee Jones 1946 Therefore, given an actor s name, there is only one possible value for birth and for city name birth name city However, given a birth year, we do not have a unique corresponding name or city birth name birth city San Saba John Wells 1957 Alexandria Steven Spielberg 1946 Cincinnati Daniel Day-Lewis 1957 Greenwich Cannot tell from example whether or not city determines name or birth

10 FUNCTIONAL DEPENDENCY Constraint between two sets of attributes from the database Given relation scheme R(A 1, A 2,, A n ) and two sets of attributes X {A 1,A 2,,A n } and Y {A 1,A 2,,A n }, then X Y specifies the following constraint: For any two tuples t 1 and t 2 in any valid relation state r of R, if t 1 [X] = t 2 [X] then t 1 [Y] = t 2 [Y]. Property of semantics or meaning of the attributes Recognized and recorded as part of database design Given a relation state Cannot determine which functional dependencies hold Can state that functional dependency does not hold if there are tuples that show violation of the dependency Write {B 1,B 2,,B i } {C 1,C 2,,C j } but can omit set braces if i=1 or j=1, respectively e.g., {name} {birth,city} or name {birth,city}

12 TRIVIAL FUNCTIONAL DEPENDENCIES Some dependencies must always hold {birth, date} {birth, date} {birth, date} date {birth, date} birth Formally: For any relation schema R and subsets of attributes X and Y in R, if Y X, then X Y

13 ANOTHER LOOK AT KEYS Assume we have the following (candidate) keys for the relation schema Employee(EmpNo, FirstName, LastName, Department, Email, Phone) 1. { EmpNo } 2. { Email } 3. { FirstName, LastName, Department } Some functional dependencies: EmpNo {EmpNo,FirstName, LastName, Department, Email, Phone} Email {EmpNo,FirstName, LastName, Department, Email, Phone} {FirstName, LastName, Department} {EmpNo,FirstName, LastName, Department, Email, Phone} {EmpNo, Email, Phone} {EmpNo,FirstName, LastName, Department, Email, Phone} Given relation schema R(A 1,A 2,,A n ) and set of attributes X in R, X is a superkey for R if X {A 1,A 2,,A n } Often written as X R To determine that X is a key, need to also show that no proper subset of X determines R i.e., there does not exist a Y such that Y X and Y R

BOYCE-CODD NORMAL FORM A relation schema R is in Boyce-Codd Normal Form (BCNF) if whenever a nontrivial functional dependency X A holds in R, then X is a superkey of R i.e., if X A and A X, then X R Relation schemas in BCNF avoid the problems of redundancy Examples Dnumber {Dname, Dmgr_ssn} but Dnumber Ename Pnumber {Pname, Plocation} but Dnumber SSn SSn Ename but SSn Pnumber We won t worry about other normal forms in this class

15 LECTURE SUMMARY Informal guidelines for good design Functional dependency Basic tool for analyzing relational schemas Check for Boyce-Codd Normal Form (BCNF) to validate designs