Functional Dependencies

Slides:



Advertisements
Similar presentations
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
Advertisements

603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 6 A First Course in Database Systems.
Lecture 6: Design Constraints and Functional Dependencies January 21st, 2004.
Functional Dependencies Definition: If two tuples agree on the attributes A, A, … A 12n then they must also agree on the attributes B, B, … B 12m Formally:
Lecture #3 Functional Dependencies Normalization Relational Algebra Thursday, October 12, 2000.
Multiplicity in E/R Diagrams
Relation Decomposition A, A, … A 12n Given a relation R with attributes Create two relations R1 and R2 with attributes B, B, … B 12m C, C, … C 12l Such.
Functional Dependencies and Relational Schema Design.
Entity / Relationship Diagrams Objects entities Classes entity sets Attributes are like in ODL. Relationships: like in ODL except - not associated with.
E/R Diagrams and Functional Dependencies. Modeling Subclasses The world is inherently hierarchical. Some entities are special cases of others We need.
Lecture 08: E/R Diagrams and Functional Dependencies.
Conceptual Database Design. Building an Application with a DBMS Requirements modeling (conceptual, pictures) –Decide what entities should be part of the.
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
Functional Dependencies CIS 4301 Lecture Notes Lecture 8 - 2/7/2006.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
1 Lecture 08: E/R Diagrams and Functional Dependencies Friday, January 21, 2005.
Functional Dependencies Zaki Malik September 25, 2008.
COMP 430 Intro. to Database Systems Entity-Relationship Diagram Basics Slides use ideas from Chris Ré.
Modeling Constraints Extracting constraints is what modeling is all about. But how do we express them? Examples: Keys: social security number uniquely.
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
Databases 1 Sixth lecture. 2 Functional Dependencies X -> A is an assertion about a relation R that whenever two tuples of R agree on all the attributes.
1 Lecture 9: Database Design Wednesday, January 25, 2006.
Formal definition of a key A key is a set of attributes A 1,..., A n such that for any other attribute B: A 1,..., A n  B A minimal key is a set of attributes.
1 Normalization Theory. 2 Limitations of E-R Designs Provides a set of guidelines, does not result in a unique database schema Does not provide a way.
The Relational Data Model Database Model (ODL, E/R) Relational Schema Physical storage ODL definitions Diagrams (E/R) Tables: row names: attributes rows:
COP Introduction to Database Structures
Lecture 11: Functional Dependencies
Lecture 5: Conceptual Database Design
Modeling Constraints Extracting constraints is what modeling is all about. But how do we express them? Examples: Keys: social security number uniquely.
COP5725 Database Management ER DIAGRAM AND RELATIONAL DATA MODEL
Database Design Oct. 3, 2001.
Database Design Why do we need it? Consider issues such as:
Functional Dependency
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Conceptual Database Design
Handout 4 Functional Dependencies
Order Database – ER Diagram
From E/R Diagrams to Relational Schema
Faloutsos & Pavlo SCS /615 Carnegie Mellon Univ. Dept. of Computer Science /615 - DB Applications Lecture #16: Schema Refinement & Normalization.
Cse 344 May 11th – Entities.
Multivalued Dependencies & Fourth Normal Form (4NF)
Entity – Relationship Model
Lecture 2: Database Modeling (end) The Relational Data Model
Temple University – CIS Dept. CIS331– Principles of Database Systems
Lecture 06 Data Modeling: E/R Diagrams
Cse 344 May 16th – Normalization.
Functional Dependencies and Relational Schema Design
Introduction to Database Systems CSE 444 Lectures 8 & 9 Database Design October 12 & 15, 2007.
Lecture 09: Functional Dependencies, Database Design
name category name price makes Company Product stockprice buys employs
Building a Database Application
Functional Dependencies
Lecture 8: Database Design
Functional Dependencies
Lecture 8: The E/R Model I
Lecture 9: The E/R Model II
Lecture 07: E/R Diagrams and Functional Dependencies
Functional Dependencies
CSE544 Data Modeling, Conceptual Design
Lecture 06: SQL Monday, October 11, 2004.
Chapter 19 (part 1) Functional Dependencies
Functional Dependencies
CS4433 Database Systems E-R Model.
Terminology Product Attribute names Name Price Category Manufacturer
Lecture 08: E/R Diagrams and Functional Dependencies
Lecture 6: Functional Dependencies
Chapter 3: Multivalued Dependencies
Lecture 09: Functional Dependencies
Presentation transcript:

Functional Dependencies Definition: If two tuples agree on the attributes A , A , … A 1 2 n then they must also agree on the attributes B , B , … B 1 2 m Formally: A , A , … A B , B , … B 1 2 n 1 2 m Motivating example for the study of functional dependencies: Name Social Security Number Phone Number

Examples Product: name price, manufacturer Person: ssn name, age Company: name stock price, president Key of a relation is a set of attributes that: - functionally determines all the attributes of the relation - none of its subsets determines all the attributes. Superkey: a set of attributes that contains a key.

Finding the Attributes of a Relation Given a relation constructed from an E/R diagram, what is its key? Rules: 1. If the relation comes from an entity set, the key of the relation is the set of attributes which is the key of the entity set. Person name ssn address

Rules for Binary Relationships name buys Person Product price name ssn Several cases are possible for a binary relationship E1 - E2: 1. Many-many: the key includes the of E1 together with the key of E2. What happens for: 2. Many-one: 3. One-one:

Rules for Multiway Relationships None, really. Except: if there is an arrow from the relationship to E, then we don’t need the key of E as part of the relation key. Product Purchase Store Payment Method Person

Some Properties of FD’s A , A , … A B , B , … B Is equivalent to 1 2 n 1 2 m A , A , … A B 1 2 n 1 Splitting rule and Combing rule A , A , … A B 1 2 n 2 … A , A , … A B 1 2 n m A , A , … A A Always holds. 1 2 n i

Comparing Functional Dependencies Entailment: a set of functional dependencies S1 entails a set S2 if: any database that satisfies S1 much also satisfy S2. Example: A B, B C entails A C Equivalence: two sets of FD’s are equivalent if each entails the other. {A B, B C } is equivalent to {A B, A C, B C}

Closure of a set of Attributes Given a set of attributes A and a set of dependencies C, we want to find all the other attributes that are functionally determined by A. In other words, we want to find the maximal set of attributes B, such that for every B in B, C entails A B.

Closure Algorithm Start with Closure=A. Until closure doesn’t change do: if is in C, and B is not in Closure then add B to closure. A , A , … A B 1 2 n A , A , … A Are all in the closure, and 1 2 n

Example A B C A D E B D A F B Closure of {A,B}: Closure of {A, F}: