Functional Dependencies and Normalization for Relational Databases 1 Chapter 15 تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في.

Slides:



Advertisements
Similar presentations
primary key constraint foreign key constraint
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
Chapter 3 Notes. 3.1 Functional Dependencies A functional dependency is a statement that – two tuples of a relation that agree on some particular set.
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
+ Review: Normalization and data anomalies CSCI 2141 W2013 Slide set modified from courses.ischool.berkeley.edu/i257/f06/.../Lecture06_257.ppt.
Functional Dependencies and Normalization for Relational Databases.
Functional Dependencies and Normalization for Relational Databases
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
METU Department of Computer Eng Ceng 302 Introduction to DBMS Functional Dependencies and Normalization for Relational Databases by Pinar Senkul resources:
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Dr. Alexandra I. Cristea CS 319: Theory of Databases: C3.
Announcements Homework 1 due Friday. Slip it under my office door (1155) or put in my mailbox on 5 th floor. Program 2 has been graded ;-( Program 3 out.
Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Functional Dependencies and Normalization for Relational Databases.
FUNCTIONAL DEPENDENCIES. Chapter Outline 1 Informal Design Guidelines for Relational Databases 1.1Semantics of the Relation Attributes 1.2 Redundant Information.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 6 NORMALIZATION FOR RELATIONAL DATABASES Instructor Ms. Arwa Binsaleh.
King Saud University College of Computer & Information Sciences Computer Science Department CS 380 Introduction to Database Systems Functional Dependencies.
DatabaseIM ISU1 Chapter 10 Functional Dependencies and Normalization for RDBs Fundamentals of Database Systems.
Lecture 1 of Advanced Databases Basic Concepts Instructor: Mr.Ahmed Al Astal.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Topic 10 Functional Dependencies and Normalization for Relational Databases Faculty of Information Science and Technology Mahanakorn University of Technology.
Instructor: Churee Techawut Functional Dependencies and Normalization for Relational Databases Chapter 4 CS (204)321 Database System I.
Top-Down Database Design Mini-world Requirements Conceptual schema E1 E2 R Relation schemas ?
Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Chapter Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Ihr Logo Fundamentals of Database Systems Fourth Edition El Masri & Navathe Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Logical Database Design (1 of 3) John Ortiz Lecture 6Logical Database Design (1)2 Introduction  The logical design is a process of refining DB schema.
1 Functional Dependencies and Normalization Chapter 15.
FUNCTIONAL DEPENDENCIES & NORMALIZATION
Normalization Sept. 2012ACS-3902 Yangjun Chen1 Outline: Normalization Chapter 14 – 3rd ed. (Chap. 10 – 4 th, 5 th ed.; Chap. 6, 6 th ed.) Redundant information.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Lecture 8: Database Concepts May 4, Outline From last lecture: creating views Normalization.
Deanship of Distance Learning Avicenna Center for E-Learning 1 Session - 7 Sequence - 2 Normalization Functional Dependencies Presented by: Dr. Samir Tartir.
Chapter 7 Functional Dependencies
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Chapter :- 3 Database Designing.
14-1 Chapter 14 Functional Dependencies and Normalization for Relational Database.
Chapter 7 Functional Dependencies Copyright © 2004 Pearson Education, Inc.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
Chapter 8 Relational Database Design. 2 Relational Database Design: Goals n Reduce data redundancy (undesirable replication of data values) n Minimize.
11/06/97J-1 Principles of Relational Design Chapter 12.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 10 Functional Dependencies and Normalization for Relational Databases.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
Chapter 14 Functional Dependencies and Normalization Informal Design Guidelines for Relational Databases –Semantics of the Relation Attributes –Redundant.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
10/3/2017.
10/3/2017.
Functional Dependency and Normalization
Functional Dependencies and Normalization for Relational Databases
Normalization Functional Dependencies Presented by: Dr. Samir Tartir
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Functional Dependencies and Normalization for RDBs
Functional Dependencies and Normalization for Relational Databases
Database Management systems Subject Code: 10CS54 Prepared By:
Outline: Normalization
Normalization.
Presentation transcript:

Functional Dependencies and Normalization for Relational Databases 1 Chapter 15 تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في ذلك. حيث المرجع الاساسي للمادة هي الكتاب المعتمد في وصف المقرر

Functional Dependencies FDs Chapter 10-2  FDs specify semantic constraints among the attributes of a relation schema 2  The most single important concept in relational schema design theory is a Functional Dependency FD 2

Functional Dependencies FDs Chapter  A set of attributes X functionally determines a set of attributes Y if the value of X determines a unique value for Y ABCD a1b1c1d1 a1b1c1d2 a1b2c2d1 a2b1c3d1 A and B determine C 3

Functional Dependencies Chapter 10-4 ABCD a1b1c1d1 a1b1c1d2 a1b2c2d1 a2b1c3d1 4  The first two tuples show that a FD is not the same as key constraint (AB is not a key)  The third and fourth tuples show that if two tuples differ in either A or B, they can differ in C without violating the FD  If we add tuple(a1, b1, c2, d1) the resulting instance would violate the FD 4

Functional Dependencies Chapter 10-5  FD written as X → Y and read as X functionally determines Y, or simply as X determine Y  X → Y holds if whenever two tuples have the same value for X, they must have the same value for Y  X → Y if and only if  For any two tuples t 1 and t 2 in any relation instances r(R) If t 1 [X]=t 2 [X] then t 1 [Y]=t 2 [Y]  If K is a key of R, then K functionally determines all attributes in R (since we never have two distinct tuples with t 1 [K]=t 2 [K]) 5 5

Functional Dependencies Chapter 10-6  FDs are derived from the real-world constraints on the attributes, for example  Social security number determines employee name SSN → ENAME  Project number determines project name and location PNUMBER → {PNAME, PLOCATION}  SSN and project number determines the hours per week that the employee works on the project {SSN, PNUMBER} → HOURS 6 6

Functional Dependencies 7  FD is a property of the semantics of attributes  The database designers will use their understanding of the semantics of the attributes and how they relate to one another, then specify the FDs that should hold on all relation states(Extensions) 7

Functional Dependencies 8  FDs cannot be inferred automatically from a given relation extension, but must be define explicitly by someone who knows the semantics of the attributes TEACHERCOURSEAuthor SmithData StructureBartram SmithData ManagementAl-Nour HallCompilerHoffman BrownData StructureSahny 8

Functional Dependencies 9  Although, at first glance we may think that Author → COURSE, we cannot confirm this unless we know that it is true for all possible legal state  However, it is sufficient to present a single counter example to disprove a FD, for example  Because Smith teach both Data Structure and Data Management we can conclude TEACHER does not functionally determine COURSE 9

Functional Dependencies 10  Relation Extensions r(R) that satisfy the FD are called Legal Extensions  The main use of FDs is to describe further a relation schema by specifying constraints on its attributes that must hold at all times  Certain FDs can be specified without referring to a specific relation, for example  {STATE, DRIVER_LICENCE_NUMBER } → SSN Should hold for any adult in the USA 10

Inference Rules for FDs Chapter  Practically, it is difficult to specify all possible FDs for a given relation  Typically, the designer specifies the FDs that are semantically obvious (denoted by F)  Usually, however, numerous other FDs hold in all legal relation instances  The other dependencies can be inferred or deduced from FDs in F 11

Inference Rules for FDs Chapter  For example, if each department has one manager then DEPT_NO → MGR_SSN  A manager has a unique phone number then MGR_SSN → MGR_PHONE  These two dependencies together imply that DEPT_NO → MGR_PHONE  This is an inferred FD and need not be explicitly stated  Formally, Given a set F of FDs, the closure F + of that set is the set of all FDs that can be inferred from F 12

Inference Rules for FDs Chapter  For example, Suppose that we specify the following set F = { SSN → {ENAME, BDATE, ADDRESS, DNUMBER}, DNUMBER → {DNAME, DMGRSSN} }  We can infer additional FDs SSN → {DNAME, DMGRSSN} SSN → SSN DNUMBER → DNAME 13

Inference Rules for FDs 14  An FD X → Y is inferred from a set of dependencies F specified on R if X → Y holds in every legal relation state r of R  To determine a systematic way to infer dependencies, we must discover a set of inference rules that can be used to infer new dependencies from a given set of dependencies  The notation  Is used to denote that the FD X → Y is inferred from the set of FDs F 14

Inference Rules for FDs Armstrong's inference rules Chapter  IR 1. (Reflexive)  If Y subset-of X, then X → Y  IR 2. (Augmentation)  If X → Y, then XZ → YZ (Notation: XZ stands for X U Z)  IR 3. (Transitive)  If X → Y and Y → Z, then X → Z 15

Inference Rules for FDs Chapter  IR 1, IR 2, IR 3 are Complete & Sound set of inference rules  Complete  All FDs implied by F can be derived by these rule  Repeated application of these rules will generate all FDs in F +  Sound  No additional FDs can be so derived  They generate only FDs in F +  In other word, these rules can be used to derive precisely the closure F + 16

Inference Rules for FDs Chapter  Several further rules can be derived from the three already given  Self determination X → X  Composition If X → Y and W → Z then XW → YZ  Decomposition If X → YZ, then X → Y and X → Z  Union If X → Y and X → Z, then X → YZ  (Psuedotransitivity) If X → Y and WY → Z, then WX → Z 17

Inference Rules for FDs Chapter Proof Decomposition If X → YZ, then X → Y and X → Z 1. X → YZ (Given) 2. YZ → Y (IR 1 ) 3. X → Y ( IR 3 On 1, 2 ) Proof Union If X → Y and X → Z, then X → YZ 1. X → Y (Given) 2. X → Z (Given) 3. X → XY (IR 2 On 1 By augmenting with X Notice XX=X) 4. XY → YZ (IR 2 On 2 By augmenting with Y) 5. X → YZ (IR 3 On 3,4) 18

Inference Rules for FDs Chapter Proof Psuedotransitivity If X → Y and WY → Z, then WX → Z 1. X → Y (Given) 2. WY → Z (Given) 3. WX → WY ( IR 2 On 1 By augmenting with W ) 4. WX → Z ( IR 3 On 3, 2) Proof Composition If X → Y and W → Z then XW → YZ 1. X → Y (Given) 2. W → Z (Given) 3. ZX → YZ (IR 2 On 1 By augmenting with Z) 4. XW → ZX (IR 2 On 2 By augmenting with X) 5. XW → YZ (IR 3 On 3,4) 19