CS 3630 Database Design and Implementation. 2 Functions y = f(x) x1 = x2  f(x1) = f(x2) Same x value, then same function value. Yes, it’s a function!

Slides:



Advertisements
Similar presentations
Unnormalized Form (UNF) student courses John CS363 CS334 CS323 Multi-Value attribute Common in reports 1.
Advertisements

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 16 Relational Database Design Algorithms and Further Dependencies.
RELATIONAL DATABASES. Relational data Structure RELATION: Table with columns and rows ATTRIBUTE: Column of a relation DOMAIN: Set of allowable values.
Assignment Design Methodology A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the.
Database Management COP4540, SCS, FIU Functional Dependencies (Chapter 14)
The Relational Model System Development Life Cycle Normalisation
Boyce-Codd Normal Form (BCNF) Definition R in 1NF and Every determinant (the left side of a FD) is a candidate key. 1.
Cs3431 Normalization. cs3431 Why Normalization? To remove potential redundancy in design Redundancy causes several anomalies: insert, delete and update.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
1 Design Methodology A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the process of design.
CS 3630 Database Design and Implementation. First Normal Form (1NF) No multi-value attributes Done when mapping E-R model to relational schema DBDL 2.
1 CS 3630 Database Design and Implementation. 2 Final Exam 7:00 – 8:52 PM, Thursday, May 16 Section 1: Ull 009 Section 2: Ull Points –50 points.
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial Password: UWPstudent Password is case sensitive.
Assignment 5-1 Functional Dependencies Attributes within one table True for all table instances Part of table schema (Assumptions) Cannot get FDs just.
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Chapter 4 The Relational Model Pearson Education © 2014.
Relational Model Session 6 Course Name: Database System Year : 2012.
CS 405G: Introduction to Database Systems 16. Functional Dependency.
Chapter 4 The Relational Model.
Chapter 6 Normalization 正規化. 6-2 In This Chapter You Will Learn:  更動異常  How tables that contain redundant data can suffer from update anomalies ( 更動異常.
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Database Management COP4540, SCS, FIU Relation Normalization (Chapter 14)
Normalization Transparencies
Lecture9:Functional Dependencies and Normalization for Relational Databases Prepared by L. Nouf Almujally Ref. Chapter Lecture9 1.
CSC271 Database Systems Lecture # 28.
1 CS 3630 Database Design and Implementation. 2 Sets Foundation of relational database. Basic Operations Power set Mapping.
CS 3630 Database Design and Implementation. 2 E-R Model (II) Keys To identify records in a table Candidate Key Primary Key Alternate Key Composite Key.
1 E-R Model (II) Keys To identify records in a table Candidate Key Primary Key Alternate Key Composite Key.
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.
Creating Tables and Inserting Records -- Not easy to edit! -- check constraints! Create table test1 ( C1 char(5) primary key, C2 Varchar2(15) not null.
Chapter 13 Normalization © Pearson Education Limited 1995, 2005.
Lecture 5 Normalization. Objectives The purpose of normalization. How normalization can be used when designing a relational database. The potential problems.
Chapter 13 Normalization Transparencies Last Updated: 08 th May 2011 By M. Arief
Chapter 10 Normalization Pearson Education © 2009.
Functional Dependencies. FarkasCSCE 5202 Reading and Exercises Database Systems- The Complete Book: Chapter 3.1, 3.2, 3.3., 3.4 Following lecture slides.
CS 3630 Database Design and Implementation. Database Schema Branch (Bno…) Staff (Sno…Bno) Owner (Ono…) PropertyForRent (Pno…Ono) Renter (Rno…) Viewing.
CS 3630 Database Design and Implementation. 2 Design Methodology Three main phases 1.Conceptual database design Understanding client data E-R (EER) Model.
CS 3630 Database Design and Implementation. Unnormalized Form (UNF) student courses John CS363 CS334 CS323 Multi-Value attribute Common in reports 2.
Lecture9:Functional Dependencies and Normalization for Relational Databases Ref. Chapter Lecture9 1.
1 CSE 480: Database Systems Lecture 18: Normal Forms and Normalization.
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Branch (Bno, Area, City, Pcode) Staff (Sno, FName, LName, Position, Sex, DOB, Salary, Bno) Property_for Rent (Pno, Area, City, Type, Rooms, Rent, Ono,
Second Normal Form (2NF) A relation R is in 1NF, and every non-primary-key attribute is fully functionally dependent on the primary key Then R is in 2NF.
Quiz Where to Store Attributes of Relationship Staff (1) Interviews (0..*) Client Attributes: date, time, comment Staff (StaffNo, …) PK: StaffNo.
Rensselaer Polytechnic Institute CSCI-4380 – Database Systems David Goldschmidt, Ph.D.
CS 3630 Database Design and Implementation. Null Value The value of an attribute could be NULL NOT known at the moment or NOT Applicable Example Cell.
Ch 7: Normalization-Part 1
Mapping ER to Relational Model Each strong entity set becomes a table. Each weak entity set also becomes a table by adding primary key of owner entity.
Databases : Functional Dependencies 2007, Fall Pusan National University Ki-Joune Li.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
1 CS 430 Database Theory Winter 2005 Lecture 8: Functional Dependencies Second, Third, and Boyce-Codd Normal Forms.
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
1 CS490 Database Management Systems. 2 CS490 Database Normalization.
Chapter 9 Normalization Chapter 14 & 15 in Textbook.
Chapter 8 Relational Database Design Topic 1: Normalization Chuan Li 1 © Pearson Education Limited 1995, 2005.
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
Database Normalization
CS 3630 Database Design and Implementation
Chapter 14 Normalization – Part I Pearson Education © 2009.
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
Chapter 14 Normalization.
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
Presentation transcript:

CS 3630 Database Design and Implementation

2 Functions y = f(x) x1 = x2  f(x1) = f(x2) Same x value, then same function value. Yes, it’s a function! x1 = x2  f(x1) != f(x2) Same x value, but different function values. No, it’s NOT a function! x1 != x2  f(x1) != f(x2) or f(x1) = f(x2) Different x values, then same or different function values. It’s Good! Still a function!

3 Example Staff_and_Branch (Sno, Name, Address, Bno, BAddress) FD: Sno  Name Sno  Address Sno  Bno Sno  Baddress Sno  Name, Address, Bno, Baddress(one FD replacing 4 FDs) Sno  All(one FD replacing 4 FDs) Sno is unique (PK)! SnoNameAddressBnoBAddress S001J. Clifton102 mainB011 westhill S002M. Smith102 mainB023 easttown S013M. Smith20 mainB011 westhill ?????

4 Example Staff_and_Branch (Sno, Name, Address, Bno, BAddress) FD: Bno  Baddress Baddress  Bno One branch has one address. One address has one branch. SnoNameAddressBnoBAddress S001J. Clifton102 mainB011 westhill S002M. Smith102 mainB023 easttown S013M. Smith20 mainB011 westhill ?????

5 Example Staff_and_Branch (Sno, Name, Address, Bno, BAddress) FD: Name  Sno(False!) Address  Sno(False!) Different staff members (Sno) may have the same name. Different staff members may have the same address. SnoNameAddressBnoBAddress S001J. Clifton102 mainB011 westhill S002M. Smith102 mainB023 easttown S013M. Smith20 mainB011 westhill ?????

6 Multiple Variables y = f(x) x  y y = f(x1, x2, x3, x4) x1, x2, x3, x4  y (y1, y2, y3) = f(x) x  y1, y2, y3 (y1, y2, y3) = f(x1, x2, x3, x4) x1, x2, x3, x4  y1, y2, y3

7 Functional Dependency Definition In a relation (table) R S: a set of attributes T: a set of attributes S  T For ANY relation (table) instance If two records of R have the same values on S Then they will have the same values on T. S is called the determinant. Each value of S is associated with exactly one value of T. T = f(S) Different values of S, we do not care! It’s good!

8 Trivial FDs If A, B  X, Y, Z Then A, B  X, Y (trivial)(for any subset of (X, Y, Z)) (reducing on the right side) Do not list A, B  X, Y If the following is true A, B  X, Y, Z

9 Trivial FDs If A, B  X, Y, Z Then A, B, C  X, Y, Z (trivial) (adding to the determinant) Do not list A, B, C  X, Y, Z If the following is true A, B  X, Y, Z

10 Trivial FDs A, B  X, Y, Z (Do it this way) The above FD is equivalent to the following three FDs: A, B  X A, B  Y A, B  Z A, B, C  A, B, C (trivial) A, B, C  A, C (trivial) A, B, C  All (other attributes) (Do it this way when true)

11 Example Assumptions No multi-value attribute Pno and PAddress identifies property unit (house, apartment, room) for renting A property can only be leased out once at a given time, but may have many leases for different times with different rents. When a group of people rent one property together, there will be only one lease with one renter from the group Lease (Rno, Rname, Pno, PAddress, Rent, Start, Finish, Ono, OName) List all non-trivial FDs: Primary Key: Alternate Keys:

12 Candidate Keys and FDs For any attribute X of a table Candidate Key  X PK  X AK  X Candidate key uniquely identifies tables records. Any two different records must have different values for the candidate key. If S is a candidate key, then S  All If S  All, then S is a candidate key (if S is minimum: S  All is not trival)

13 Partial FDs If X, W  Y and X  Y Then X, W  Y is trivial and a partial FD Example: Sno, Bno  Address, Phone Partial? Yes! Sno  Address, Phone

14 Full FDs A FD is a full FD if it’s not partial. A, B  X, Y is a full FD if A  X, Y is false B  X, Y is false Sno  Address, Phone Pno, Start  Rno, Rent, End

15 Transitive FDs If A  B and B  C Then A  C is always TRUE (provided A is not functionally dependent on either B or C) (NO cycle!)

16 Transitive FDs If A  B and B  C Then A  C ABC

17 Transitive FDs If A  B and B  C Then A  C Provided not B  A (A and B are equivalent) nor C  A (A, B and C are equivalent) No Cycle! ABC

Assignment 5-1 Due Wednesday, February 25 18

Quiz 1 19