R EVIEW. 22 Exam Su 3:30PM - 6:30PM 2010/12/12 Room C9000.

Slides:



Advertisements
Similar presentations
primary key constraint foreign key constraint
Advertisements

Schema Refinement and Normal Forms
1 Design Theory. 2 Minimal Sets of Dependancies A set of dependencies is minimal if: 1.Every right side is a single attribute 2.For no X  A in F and.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
CS Schema Refinement and Normal Forms Chapter 19.
Normalization DB Tuning CS186 Final Review Session.
Normalization DB Tuning CS186 Final Review Session.
Schema Refinement and Normal Forms
H.Lu/HKUST L02: Logical Database Design  Introduction  Functional Dependencies  Normal Forms  Normalization by decomposition.
1 Normalization Chapter What it’s all about Given a relation, R, and a set of functional dependencies, F, on R. Assume that R is not in a desirable.
Schema Refinement and Normal Forms. The Evils of Redundancy v Redundancy is at the root of several problems associated with relational schemas: – redundant.
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
Cs3431 Normalization Part II. cs3431 Attribute Closure : Example Consider R (A, B, C, D, E) with FDs A  B, B  C, CD  E Does A  E hold ? (Is A  E.
1 Schema Refinement and Normal Forms Yanlei Diao UMass Amherst April 10, 2007 Slides Courtesy of R. Ramakrishnan and J. Gehrke.
Functional Dependencies CS 186, Spring 2006, Lecture 21 R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another.
1 Database Theory and Methodology. 2 The Good and the Bad So far we have not developed any measure of “goodness” to measure the quality of the design,
Database Management Systems, R. Ramakrishnan and J. Gehrke 1 Schema Refinement and Normal Forms Chapter 19 Instructor: Mirsad Hadzikadic.
Schema Refinement and Normal Forms Jianlin Feng School of Software SUN YAT-SEN UNIVERSITY courtesy of Joe Hellerstein for some slides.
Normal Forms1. 2 The Problems of Redundancy Redundancy is at the root of several problems associated with relational schemas: Wastes storage Causes problems.
CSCD34 - Data Management Systems - A. Vaisman1 Schema Refinement and Normal Forms.
Schema Refinement and Normalization. Functional Dependencies (Review) A functional dependency X  Y holds over relation schema R if, for every allowable.
Schema Refinement and Normal Forms Chapter 19 1 Database Management Systems 3ed, R.Ramakrishnan & J.Gehrke.
1 Schema Refinement, Normalization, and Tuning. 2 Design Steps v The design steps: 1.Real-World 2. ER model 3. Relational Schema 4. Better relational.
LECTURE 5: Schema Refinement and Normal Forms SOME OF THESE SLIDES ARE BASED ON YOUR TEXT BOOK.
Functional Dependencies and Normalization R&G Chapter 19 Lecture 26 Science is the knowledge of consequences, and dependence of one fact upon another.
Christoph F. Eick: Functional Dependencies, BCNF, and Normalization 1 Functional Dependencies, BCNF and Normalization.
Functional Dependencies And Normalization R&G Chapter 19.
Database Systems/COMP4910/Spring02/Melikyan1 Schema Refinement and Normal Forms.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
1 Schema Refinement and Normal Forms Week 6. 2 The Evils of Redundancy  Redundancy is at the root of several problems associated with relational schemas:
1 Functional Dependencies. 2 Motivation v E/R  Relational translation problems : –Often discover more “detailed” constraints after translation (upcoming.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 15.
Functional Dependencies R&G Chapter 19 Science is the knowledge of consequences, and dependence of one fact upon another. Thomas Hobbes ( )
Announcements Program 3 due Friday Homework 2 out today, due Mon Read: Chapter 3.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
UNIT IV – Schema refinement – Problems Caused by redundancy
Schema Refinement and Normalization Nobody realizes that some people expend tremendous energy merely to be normal. Albert Camus.
1 Schema Refinement and Normal Forms Chapter The Evils of Redundancy  Redundancy is at the root of several problems associated with relational.
CS542 1 Schema Refinement Chapter 19 (part 1) Functional Dependencies.
Database Management Systems, 3ed, R. Ramakrishnan and J. Gehrke1 Schema Refinement and Normal Forms Chapter 19.
1 Schema Refinement and Normal Forms Chapter The Evils of Redundancy  Redundancy causes several problems associated with relational schemas: 
Normalization and FUNctional Dependencies. Redundancy: root of several problems with relational schemas: –redundant storage, insert/delete/update anomalies.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
1 CS122A: Introduction to Data Management Lecture #12: Relational DB Design Theory (1) Instructor: Chen Li.
LECTURE 5: Schema Refinement and Normal Forms 1. Redundency Problem Redundent Storage Update Anomaly If one copy updated, an inconsistancy may occur Insertion.
1 CS122A: Introduction to Data Management Lecture #13: Relational DB Design Theory (II) Instructor: Chen Li.
CSC 411/511: DBMS Design Dr. Nan Wang 1 Schema Refinement and Normal Forms Chapter 19.
Schema Refinement & Normal Forms.
Functional Dependencies and Schema Refinement
Introduction to Database Systems Functional Dependencies
Schema Refinement and Normal Forms
UNIT - 3 DATABASE DESIGN Functional Dependencies
Normalization First Normal Form (1NF) Boyce-Codd Normal Form (BCNF)
Functional Dependencies, BCNF and Normalization
Functional Dependencies, BCNF and Normalization
Schema Refinement & Normalization Theory
Functional Dependencies
Functional Dependencies and Normalization
Normalization Murali Mani.
Schema Refinement and Normal Forms
LECTURE 5: Schema Refinement and Normal Forms
Functional Dependencies
Normalization Part II cs3431.
Schema Refinement and Normalization
Normalization cs3431.
Chapter 19 (part 1) Functional Dependencies
Schema Refinement and Normal Forms
Schema Refinement and Normal Forms
CSC 453 Database Systems Lecture
CS4222 Principles of Database System
Presentation transcript:

R EVIEW

22 Exam Su 3:30PM - 6:30PM 2010/12/12 Room C9000

A LGEBRA

44 R ELATIONAL A LGEBRA O PERATIONS Basic operations Selection ( ) Selects a subset of rows from relation. Projection ( ) Deletes unwanted columns from relation. Cartesian product ( ) Combine two relations. Set-difference ( ) Tuples in relation 1, but not in relation 2. Union ( ) Tuples in relation 1 or in relation 2.

55 Suppliers (S) sid sname address Parts (P) pid pname color Catalog (C) sid pid cost

66 Suppliers (S) sid sname address Parts (P) pid pname color Catalog (C) sid pid cost

77 Suppliers (S) sid sname address Parts (P) pid pname color Catalog (C) sid pid cost

88 Suppliers (S) sid sname address Parts (P) pid pname color Catalog (C) sid pid cost

99 Suppliers (S) sid sname address Parts (P) pid pname color Catalog (C) sid pid cost

10 Suppliers (S) sid sname address Parts (P) pid pname color Catalog (C) sid pid cost

F UNCTIONAL D EPENDENCY

12 F UNCTIONAL D EPENDENCIES (FD S ) A functional dependency X  Y holds over relation R if, for every allowable instance r of R: given two tuples in r, if the X values agree, then the Y values must also agree. (X and Y are sets of attributes.) An FD is a statement about all allowable relations. Must be identified based on semantics of application. Given some allowable instance r1 of R, we can check if it violates some FD f, but we cannot tell if f holds over R! K is a candidate key for R means that K  R However, K  R does not require K to be minimal!

13 E XAMPLE (C ONTD.) Problems due to R W : Update anomaly : Can we change W in just the 1st tuple of SNLRWH? Insertion anomaly : What if we want to insert an employee and don’t know the hourly wage for his rating? Deletion anomaly : If we delete all employees with rating 5, we lose the information about the wage for rating 5! Hourly_Emps2 Wages

14 R EASONING A BOUT FD S (C ONTD.) Couple of additional rules (that follow from AA): Union : If X  Y and X  Z, then X  YZ Decomposition : If X  YZ, then X  Y and X  Z Example: Contracts( cid,sid,jid,did,pid,qty,value ), and: C is the key: C  CSJDPQV Project purchases a part using single contract: JP  C Dept purchases at most a part from a supplier:SD  P JP  C, C  CSJDPQV imply JP  CSJDPQV SD  P implies SDJ  JP SDJ  JP, JP  CSJDPQV imply SDJ  CSJDPQV

15 Suppose that relation R contains attributes A1... An. A decomposition of R consists of replacing R by two or more relations such that: Each new relation scheme contains a subset of the attributes of R (and no attributes that do not appear in R), and Every attribute of R appears as an attribute of one of the new relations. e.g., A  B, ABCD  E, EF  GH, ACDF  EG has the following minimal cover: A  B, ACD  E, EF  G and EF  H

16 E XAMPLES ABC Does A  B hold? Don’t know Does BC  A hold? Does not hold (first two tuples) Does B  C hold? Does not hold (last 2 tuples)

17 E XAMPLES Relation: ABCDE Dependencies: A  B C  D Decompose to?

18 E XAMPLES Relation: ABCD Dependencies: C  D C  A B  C What is the candidate key? B

19 E XAMPLES Relation: ABCD Dependencies: B  C D  A What is the candidate key? BD

20 E XAMPLES Relation: ABCD Dependencies: ABC  D D  A What is the candidate key? ABC BCD

21 E XAMPLES Relation: ABCD Dependencies: AB  C AB  D C  A D  B What is the candidate key? AB BC CD AD

22 E XAMPLES Suppose you are given a relation R(A,B,C,D) Dependencies AB  C C  A C  D What is the candidate key? AB BC Decomposed into ACD and BC. Good? Lossless. Can join back to ABCD. Dependency AB  C is not preserved.

23 E XAMPLES Suppose you are given a relation R(A,B,C,D) Dependencies A  BC C  AD What is the candidate key? A C Decomposed into ABC and AD. Good? No. A is key, so no need to decompose. Dependency C  AD is not preserved.