Functional Dependencies (FD)

Similar documents
Database Design and Normalization

Relational Database Design

Full and Complete Binary Trees

Functional Dependencies and Normalization

Functional Dependencies and Finding a Minimal Cover

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

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

Database Design and Normal Forms

Schema Design and Normal Forms Sid Name Level Rating Wage Hours

Chapter 10. Functional Dependencies and Normalization for Relational Databases

Lecture Notes on Database Normalization

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

Theory of Relational Database Design and Normalization

Chapter 10 Functional Dependencies and Normalization for Relational Databases

Design of Relational Database Schemas

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

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

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

Schema Refinement and Normalization

Theory of Relational Database Design and Normalization

Schema Refinement, Functional Dependencies, Normalization

CS143 Notes: Normalization Theory

How To Find Out What A Key Is In A Database Engine

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

Limitations of DB Design Processes

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

Database Constraints and Design

Database Management Systems. Redundancy and Other Problems. Redundancy

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

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

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

Relational Database Design Theory

Database Design and Normalization

6.3 Conditional Probability and Independence

Chapter 5: FUNCTIONAL DEPENDENCIES AND NORMALIZATION FOR RELATIONAL DATABASES

Chapter 7: Relational Database Design

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

Entity-Relationship Model. Purpose of E/R Model. Entity Sets

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

University of Ostrava. Reasoning in Description Logic with Semantic Tableau Binary Trees

Normalisation and Data Storage Devices

Relational Database Design: FD s & BCNF

Linear Programming Notes V Problem Transformations

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

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

Chapter 8. Database Design II: Relational Normalization Theory

Advanced Relational Database Design

Fundamentals of Database System

Normalization in Database Design

COMP 378 Database Systems Notes for Chapter 7 of Database System Concepts Database Design and the Entity-Relationship Model

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

The Relational Data Model: Structure

1. Prove that the empty set is a subset of every set.

MCQs~Databases~Relational Model and Normalization

Aikaterini Marazopoulou

Functional Dependencies

Lecture 5 - CPA security, Pseudorandom functions

CS 103X: Discrete Structures Homework Assignment 3 Solutions

Basics of Dimensional Modeling

Class Notes CS Creating and Using a Huffman Code. Ref: Weiss, page 433

Functional Dependency and Normalization for Relational Databases

Analysis of Algorithms I: Binary Search Trees

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

International Journal of Advanced Research in Computer Science and Software Engineering

DATABASE DESIGN - 1DL400

Design and Implementation of Firewall Policy Advisor Tools

Database Management System

Data Analysis 1. SET08104 Database Systems. Napier University

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

Regular Expressions and Automata using Haskell

Unique column combinations

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

Data Mining with R. Decision Trees and Random Forests. Hugh Murrell

Design Theory for Relational Databases: Functional Dependencies and Normalization

Properties of Real Numbers

Automata on Infinite Words and Trees

Regular Languages and Finite Automata

Unit 2.1. Data Analysis 1 - V Data Analysis 1. Dr Gordon Russell, Napier University

An Algorithmic Approach to Database Normalization

Data Structures Fibonacci Heaps, Amortized Analysis

Professor Anita Wasilewska. Classification Lecture Notes

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

2 : two cube. 5 : five cube. 10 : ten cube.

The Prime Numbers. Definition. A prime number is a positive integer with exactly two positive divisors.

Software Modeling and Verification

GOAL-BASED INTELLIGENT AGENTS

A first step towards modeling semistructured data in hybrid multimodal logic

Unit 3 Boolean Algebra (Continued)

Deterministic Finite Automata

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Mining Social Network Graphs

Lemma 5.2. Let S be a set. (1) Let f and g be two permutations of S. Then the composition of f and g is a permutation of S.

Normalization in OODB Design

Automata and Formal Languages

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

TREE BASIC TERMINOLOGIES

PLANET: Massively Parallel Learning of Tree Ensembles with MapReduce. Authors: B. Panda, J. S. Herbach, S. Basu, R. J. Bayardo.

Incorporating Evidence in Bayesian networks with the Select Operator

An Introduction to Fault Tree Analysis (FTA)

Transcription:

Example: Functional Dependencies (FD) Lets consider the following relation STUDENT(STUID, STUNAME, MAJOR, CREDITS, STATUS, SSN) Constrains: Each student has a unique SSN and ID. Each student has at most one major. Names are not unique. CREDITS means the number of credits completed. STATUS refer to the year the student is in (FSJS).

Derived Functional Dependencies: Similarly: also

Example: Consider the following relations:

INFERENCE RULES for Functional Dependencies Called inference Axioms or Amstrong Axioms Used to find all the FDs logically by a set of FDs. Let A,B,C,D be subset of attributes of a relation R. The following axioms hold:

The following rules can be derived from the previous three.

Proof of F3: Proof: Let assume that (1) A B and (2) B C holds. Then for two tuples t1, t2 such that t1[a] = t2[a] then (3) t1[b] = t2[b] and from (2) we must also have t1[c] = t2[c]. Hence A C

Proof of F5: Proof: (1) A BC given (2) BC B from F1 (3) BC C from F1 Therefore from F3: (4) A B and A C

Definition: Closure of a Functional Dependency Set F, F+: If F is a set of functional dependencies for a relation R, the set of functional dependencies that can be derived from F, F+, is called the CLOSURE of F. Amstron s axiom are sufficient to compute all of F+. Given a functional dependency g we want to determine whether it belongs into the given set of FD s F (F+). Closure of an attribute X under F, X+. The set of all attributes that are functionally dependent on X under F. Algorithm: X+ = X repeat old_x+ = X+ for each FD Y Z in F do if Y X+ then X+ = X+ Z until (old_x+ = X+)

Example: FD s: Using the above algorithm:

Example: Let R be a relation with attributes W, X, Y, Z and the functional dependencies: W Z YZ X WZ Y Q: Find the transitive closures W+, YZ+, WZ+. Which one is a key?

Discussion: Given a set of functional dependencies we want to be able to decide whether any of them is redundant. Given a functional dependency g we want to determine whether it belong into the given set of FD s F (F+). To decide redundancy we use the following algorithm: 1. Choose a candidate FD, say X Y, and remove it from the set of FDs. 2. result := X; while (result change and Y is not contained in) do for each FD, A B, remaining in the reduced set of FDs if A result, then result = result B end_while 3. If Y is a subset of result, then FD X Y is redundant.

Example: Let R be a relation with attributes W, X, Y, Z and the functional dependencies: W Z W Y YZ X WZ Y Q: Find all redundant functional dependencies.

Derivation Trees Given a functional dependency g we want to determine whether it belongs into the given set of FD s F (F+). - Use the previous algorithm or use - Derivation Tree (DT). A tree representation of the previous algorithm with path information.

Derivation Trees Definition: Let F set of FD s. The set of F-based derivation trees (FBDT) is: 1. If A is an attribute a node labeled with A is a FBDT. 2. If T is FBDT with leaf node labeled A and B1,B2,B3,,Bn A ε F then the tree constructed from T by adding B1,B2,B3,,Bn as children of the leaf node A is also a FBDT. 3. Nothing else. Example:

Let T be a FBTD, let Y be a nonempty set of labels of nodes of T, let X be the set of all attributes that appear as leaves of T. THEN X Y ε F+ For given FD g : X Y and a set F of FD s, g ε F+ if there exist a F-based Derivation Tree (FBTD) rooted at Y. Example: Let Show if f : AB F ε F+

Definitions: Equivalence of set of Functional Dependencies A set of FDs E is set to be covered by a set of functional dependencies F, if every FD in E is also in F+ F cover E Two sets of functional dependencies E and F are set to be equivalent if: E+ = F+ Minimal set of Functional Dependencies 1. Every dependency if F has a single attribute for its right-hand side. 2. We cannot remove any dependency from F and still have set of dependencies equivalent to F. 3. No attribute on the left hand side is redundant.

NORMAL FORMS First Normal Form Definition: A relation is in first normal form if and only if every attribute is single-valued for each tuple. - No composite attributes. - No multivalue attributes.

Example:

NORMAL FORMS Second Normal Form Definition: A relation is in second normal form (2NF) if and only if it is in 1NF and all nonkey attributes are fully dependent on the key. Clearly if the relation is in 1NF and the key consists of a single attribute the relation is automatically 2NF.

Example: