11/06/97J-1 Principles of Relational Design Chapter 12.

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)
Ch 10, Functional Dependencies and Normal forms
Functional Dependencies and Normalization for Relational Databases.
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.
CMSC424: Database Design Instructor: Amol Deshpande
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
1 Database Design Theory Which tables to have in a database Normalization.
Logical Model Agenda - Informal Mapping ER-Diagram to Schemas
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
Databases 6: Normalization
Chapter 8 Normalization for Relational Databases Copyright © 2004 Pearson Education, Inc.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts Chapter 7: Relational Database Design First Normal Form Pitfalls in Relational Database Design.
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.
King Saud University College of Computer & Information Sciences Computer Science Department CS 380 Introduction to Database Systems Functional Dependencies.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Normalization for Relational Databases.
DatabaseIM ISU1 Chapter 10 Functional Dependencies and Normalization for RDBs Fundamentals of Database Systems.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide
Lecture 5: Functional dependencies and normalization Jose M. Peña
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 ?
BCNF & Lossless Decomposition Prof. Sin-Min Lee Department of Computer Science.
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.
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.
Functional Dependencies and Normalization Jose M. Peña
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.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
1 Functional Dependencies and Normalization Chapter 15.
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.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
Design Process - Where are we?
Chapter 5.1 and 5.2 Brian Cobarrubia Database Management Systems II January 31, 2008.
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.
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.
CS411 Database Systems Kazuhiro Minami 04: Relational Schema Design.
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.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
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
10/3/2017.
Functional Dependency and Normalization
Functional Dependencies and Normalization for Relational Databases
Chapter 15 Basics of Functional Dependencies and Normalization for Relational Databases.
Functional Dependencies and Normalization for RDBs
Database Management systems Subject Code: 10CS54 Prepared By:
Schema Refinement and Normal Forms
Relational Database Design
Presentation transcript:

11/06/97J-1 Principles of Relational Design Chapter 12

11/06/97J-2 Things can go wrong! All the relational designs we've seen so far have been pretty good –fairly small, intuitive examples –E/R model not far away A carelessly designed schema can lead to big problems How do we evaluate a schema? How do we design a good one?

11/06/97J-3 Plan of Attack Study some informal principles (12.1) Functional dependencies: an important type of semantic constraint –define and illustrate (12.2) –use to define "normal forms" 2NF, 3NF, and BCNF ( ) Decomposition algorithms (13.1) Multivalued dependencies and 4NF (13.2) Join dependencies and 5NF (13.3)

11/06/97J-4 Informal Guidelines by Elmasri and Navathe ¶Design a relation so that it is easy to explain its meaning. ¶Design so that no insertion, deletion, or modification anomalies can occur. ¶Avoid attributes whose values can be null. ¶Design so that reasonable joins do not produce spurious tuples.

11/06/97J-5 The "Universal Relation" Approach Assume we have identified all the individual pieces of data (attributes) of the problem. The database design problem: group the attributes into relations. The informal guidelines are one way of evaluating the result. The theory of functional dependencies and normal forms gives a more precise way.

11/06/97J-6 Functional dependency defined Let X and Y be attributes X  Y means that Y is a function of X. I.e., if you know the value of X, there's only one possible value of Y. We say that "Y is functionally dependent on X" or "X determines Y." Note: X  Y does not imply Y  X !

11/06/97J-7 Examples If you know the SSN, there's only one possible name (is the reverse true?) SSN  NAME If you know the department number, you know the department name DNO  DNAME

11/06/97J-8 Dependencies between sets of attributes Given today's date and the date of birth, the age and the years until 65 are determined. {TD, DB}  {AGE, YTO65} If you know the file pathname, you can determine its size, owner, and date of last modification. FP  {SZ, O, MDT} Normally, when writing X  Y, we assume that X and Y are sets of attributes.

11/06/97J-9 Facts about FD FDs are purely semantic in nature FDs are facts about the abstract relation, not just about a particular relation instance –They must hold for all possible legal instances of a relation All attributes of a relation are functionally dependent upon its key! –In fact, we can formally define keys in terms of FDs.

11/06/97J-10 Inference Rules for FDs Given a set of FDs, it may be possible to deduce others by purely syntactic means. Example: Given that {A}  {B,C}, it follows that {A}  {B} also (and that {A}  {C})

11/06/97J-11 Armstrong's inference rules Armstrong's rules (provable directly from the definitions): –IR1. Reflexive rule: if X  Y, then X  Y –IR2. Augmentation rule: if X  Y then XZ  YZ –IR3. Transitive rule: if X  Y and Y  Z then X  Z If you understand the idea of FD, these should make sense, even if you can't prove them formally.

11/06/97J-12 Some other rules Provable from IR1-3: –IR4. Decomposition: if X  YZ then X  Y –IR5. Union (additive) rule: if X  Y and X  Z then X  YZ –IR6. Pseudotransitivity: if X  Y and WY  Z then WX  Z These should also make sense. Try them out with actual attributes!

11/06/97J-13 Closures X+ is the "closure" of X: the set of all attributes functionally determined by X (given a set of FDs)

11/06/97J-14 Nomalization Take a relation schema… Test it against a normalization criterion… If it passes, fine! –Maybe test again with a higher criterion If it fails, decompose into smaller relations –Each of them will pass the test –Each can then be tested with a higher criterion

11/06/97J-15 1st Normal Form We've already seen! It's the concept that all attribute values have to be atomic This is now taken for granted in the relational model –but is being questioned again in the object model E/R attributes don't have to be atomic

11/06/97J-16 Key Terminology Superkey: attribute set with unique value Key: minimal superkey (no attribute can be removed) May be more than one such "candidate key." One is designated the "primary key" "Prime" attribute: occurs in some key "Non-prime": occurs in no key

11/06/97J-17 Full and partial dependency X  Y is a "full functional dependency" if no attribute can be removed from X and there still be the dependency. X  Y is a "partial dependency" if some attribute can be removed from X and the dependency is still there.

11/06/97J-18 2NF A relation schema is in Second Normal Form (2NF) if every non-prime attribute in it is fully functionally dependent on the primary key of the relation. –more generally: …FFD on any key...

11/06/97J-19 3NF X  Y is a transitive dependency if there is a set of attributes Z that is not a subset of any key of R, and both X  Z and Z  Y hold. A relation schema R is in Third Normal Form (3NF) if it is in 2NF and no nonprime attribute of R is transitively dependent on the primary key.

11/06/97J-20 3NF (General Definition) A relation is in Third Normal Form (3NF) if, whenever X  A holds, either X is a superkey, or A is a prime attribute. Informally: everything depends on the key or is in the key. Despite the thorny technical definitions that lead up to it, 3NF is intuitive and not hard to achieve. Aim for it in all designs unless you have strong reasons otherwise.

11/06/97J-21 Boyce-Codd Normal Form (BCNF) R is in BFNC if whenever X  A holds, then X is a superkey. Slightly stronger than 3NF. Example: R(A,B,C) with {A,B}  C, C  A –3NF but not BCNF Aim for BCNF and settle for 3NF