Functional Dependencies

Slides:



Advertisements
Similar presentations
Functional Dependencies and Normalization for Relational Databases
Advertisements

Normalisation The theory of Relational Database Design.
Ch 10, Functional Dependencies and Normal forms
Functional Dependencies and Normalization for Relational Databases.
Kingdom of Saudi Arabia Ministry of Higher Education Al-Imam Muhammad Ibn Saud Islamic University College of Computer and Information Sciences Normalization.
Ms. Hatoon Al-Sagri CCIS – IS Department Normalization.
Functional Dependencies and Normalization for Relational Databases
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Part 6 Chapter 15 Normalization of Relational Database Csci455 r 1.
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
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.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 6 NORMALIZATION FOR RELATIONAL DATABASES Instructor Ms. Arwa Binsaleh.
Week 6 Lecture Normalization
IS 230Lecture 8Slide 1 Normalization Lecture 9. IS 230Lecture 8Slide 2 Lecture 8: Normalization 1. Normalization 2. Data redundancy and anomalies 3. Spurious.
King Saud University College of Computer & Information Sciences Computer Science Department CS 380 Introduction to Database Systems Functional Dependencies.
Database Normalization.
DatabaseIM ISU1 Chapter 10 Functional Dependencies and Normalization for RDBs Fundamentals of Database Systems.
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.
SCUJ. Holliday - coen 1784–1 Schedule Today: u Normal Forms. u Section 3.6. Next u Relational Algebra. Read chapter 5 to page 199 After that u SQL Queries.
Top-Down Database Design Mini-world Requirements Conceptual schema E1 E2 R Relation schemas ?
Functional Dependencies and Normalization for Relational Databases.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Basics of Functional Dependencies and Normalization for Relational.
Chapter Functional Dependencies and Normalization for Relational Databases.
CSE314 Database Systems Basics of Functional Dependencies and Normalization for Relational Databases Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E.
COMP1212 COMP1212 Anomalies and Dependencies Dr. Mabruk Ali.
1 Functional Dependencies and Normalization Chapter 15.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
Lecture 8: Database Concepts May 4, Outline From last lecture: creating views Normalization.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Database Design FUNCTIONAL DEPENDENCES NORMAL FORMS D. Christozov / G.Tuparov INF 280 Database Systems: DB design: Normal Forms 1.
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.
Ch 7: Normalization-Part 1
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 5 Introduction to a First Course in Database Systems.
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
Deanship of Distance Learning Avicenna Center for E-Learning 1 Session - 7 Sequence - 1 Normalization DB Design Guidelines Presented by: Dr. Samir Tartir.
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
Chapter 15 1 Functional Dependencies and Normalization for Relational Databases تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في.
Chapter 10 Functional Dependencies and Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
Copyright © 2016 Ramez Elmasri and Shamkant B. Navathe.
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
Functional Dependencies and Normalization for Relational Databases تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في ذلك. حيث المرجع.
1 Normalization David J. Stucki. Outline Informal Design Guidelines Normal Forms  1NF  2NF  3NF  BCNF  4NF 2.
COP 6726: New Directions in Database Systems
Functional Dependency and Normalization
CHAPTER 14 Basics of Functional Dependencies and Normalization for Relational Databases.
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Normal forms First Normal Form (1NF) Second Normal Form (2NF)
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Database Management systems Subject Code: 10CS54 Prepared By:
Normalization.
Normalization DB Design Guidelines Presented by: Dr. Samir Tartir
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Normalization February 28, 2019 DB:Normalization.
Sampath Jayarathna Cal Poly Pomona
Chapter 19 (part 1) Functional Dependencies
Chapter Outline 1 Informal Design Guidelines for Relational Databases
Presentation transcript:

Functional Dependencies Chapter 15.1-15.2, 15.5 (6/E) Chapter 10.1-10.2, 10.5 (5/E)

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

Goodness in Relational Design Clarity of attributes provides semantics for relation schema. Naming of attributes Fit of attributes with each other 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. 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

Mis-packaged Attributes Every tuple includes employee data and department data Redundancy Dept name and manager id repeated for every employee in dept 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 dept should not delete dept Changing the dept name/mgr requires many tuples to be updated Inserting employees requires checking for consistency of its dept name and manager Guideline 2 Design relational DB schema so that every fact can be stored in one and only one tuple.

Simple Dependencies Assume that no two actors have the same name. birth city Ben Affleck 1972 Berkeley Alan Arkin 1934 New York Tommy Lee Jones 1946 San Saba John Wells 1957 Alexandria Steven Spielberg Cincinnati Daniel Day-Lewis Greenwich Assume that no two actors have the same name. Each actor has a unique date and city of birth. 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 Cannot tell from example whether or not city determines name or birth

Functional Dependency Constraint between two sets of attributes from the database 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 {B1,B2,…,Bi}  {C1,C2,…,Cj} but can omit set braces if i=1 or j=1, respectively. {name}  {birth,city} or name  {birth,city} Given relation scheme R(A1,A2,…,An) and sets of attributes X  {A1,A2,…,An}, Y  {A1,A2,…,An}, X  Y specifies the following constraint: for any tuples t1 and t2 in any valid relation state r of R, if t1[X] = t2[X] then t1[Y] = t2[Y] .

Trivial Functional Dependencies Some dependencies must always hold {birth, date}  {birth, date} {birth, date}  date {birth, date}  birth For any relation schema R and subsets of attributes X and Y in R, if Y  X, then X Y.

Another Look at Keys Assume that EMPLOYEE(EmpNo, FirstName, LastName, Department, Email, Phone) has keys: EmpNo Email (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 scheme R(A1,A2,…,An) and set of attributes X in R. X is a superkey for R if X  {A1,A2,…,An}. Often written as X  R To determine that X is a key, need to also show that no proper subset of X determines R ∄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. If X  A and A  X, then X  R Relation schemas in BCNF avoid the problems of redundancy We won’t worry about other normal forms in this class. Examples Dnumber  {Dname, Dmgr_ssn} but Dnumber ↛ Ename Pnumber  {Pname, Plocation} but Dnumber ↛ SSn SSn  Ename but SSn ↛ Pnumber

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