CS 3630 Database Design and Implementation

Slides:



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

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.
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.
Slide 1 Chapter 05 – Part 1 Data Modeling with the Entity-Relationship Model.
Your Oracle Account UserName is the same as your UWP username Followed Not case sensitive Initial Password: UWPstudent Password is case sensitive.
DBSQL 3-1 Copyright © Genetic Computer School 2009 Chapter 3 Relational Database Model.
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
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.
Chapter 13 Normalization Transparencies Last Updated: 08 th May 2011 By M. Arief
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. 2 Functions y = f(x) x1 = x2  f(x1) = f(x2) Same x value, then same function value. Yes, it’s a function!
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.
IST 210 SQL Todd Bacastow IST 210: Organization of Data.
CS 3630 Database Design and Implementation. Unnormalized Form (UNF) student courses John CS363 CS334 CS323 Multi-Value attribute Common in reports 2.
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.
CS 3630 Database Design and Implementation
Database Design Chapters 17 and 18.
Let try to identify the conectivity of these entity relationship
Normalization.
CS 3630 Database Design and Implementation
Normalization DBMS.
Normalization Dongsheng Lu Feb 21, 2003.
CS 3630 Database Design and Implementation
Chapter 5: Logical Database Design and the Relational Model
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
Tables and Their Characteristics
Database Design The Relational Model Text Ch5
CS 3630 Database Design and Implementation
Payroll Management System
Chapter 14 Normalization
CMPE 226 Database Systems February 21 Class Meeting
CS 3630 Database Design and Implementation
CHAPTER 5 Normalization Of Database Tables (Part II: The Process)
ERD’s REVIEW DBS201.
CS 3630 Database Design and Implementation
Normalization.
Database Normalization
CS 3630 Database Design and Implementation
Chapter 14 & Chapter 15 Normalization Pearson Education © 2009.
Normalization.
Normalization Dongsheng Lu Feb 21, 2003.
CS 3630 Database Design and Implementation
ITS232 Introduction To Database Management Systems
Normalization Dale-Marie Wilson, Ph.D..
CS 3630 Database Design and Implementation
Database Design Chapters 17 and 18.
Functional Dependencies
Chapter 14 Normalization.
Normalization cs3431.
Chapter 14 Normalization.
Normalization February 28, 2019 DB:Normalization.
國立臺北科技大學 課程:資料庫系統 2015 fall Chapter 14 Normalization.
Functional Dependencies
Database Normalisation
Sampath Jayarathna Cal Poly Pomona
Sampath Jayarathna Cal Poly Pomona
Relationships—Topics
Mapping an ERD to a Relational Database
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
Database Management system
Database Management system
Presentation transcript:

CS 3630 Database Design and Implementation

Functional Dependency Definition Assume A and B are attributes of a table R. A  B (B is functionally dependent on A) If each value of A in R is associated with exactly one value of B in R. A is called Determinant. Any two records of R If they agree on A (have the same value on A), Then they will agree on B (have the same value on B). If they have different values on A, Then they may have different values or the same value on B. B = f(A)

Functional Dependency Definition In a relation (table) R S: a non-empty set of attributes T: a non-empty 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! Could skip slide #2

A1, A2, A3  B1, B2, B3, B4 Viewing (Cno, Pno, ViewDate, ViewTime, Comment) Cno, ViewDate, ViewTime  Pno, Comment Cno, ViewDate, ViewTime  All Cno, ViewDate  All Cno, ViewTime  All ViewDate, ViewTime  All True False

A1, A2, A3  B1, B2, B3, B4 Viewing (Cno, Pno, ViewDate, ViewTime, Comment) Cno, ViewDate, ViewTime  All Pno, ViewDate  All Cno, Pno, ViewDate  All True False

Trivial FDs If A, B  X, Y, Z Then the following are trivial A, B, C  X, Y, Z Reducing on the right side or Adding to the left side (the determinant)

Non-Trivial FDs A, B  X, Y, Z Minimum set of attributes on the left for the determinant Maximum set of attributes on the right Do not list A, B, C  X, Y, Z A, B  X, Y If the following is true

DreamHome Assumptions No multi-value attribute Pno identifies property unit (house, apartment, room) for renting PAddress also 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 details. 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: Each student gives one answer The table keeps all records, past, current, and future

List all non-trivial FDs Lease (Rno, Rname, Pno, PAddress, Rent, Start, Finish, Ono, OName) Pno  All Rno  All Pno, Start  All Rno, Start  All Pno, Finish  All PAddress, Start  All Paddress, Finish  All Each student gives one answer The table keeps all records, past, current, and future

List all non-trivial FDs Lease (Rno, Rname, Pno, PAddress, Rent, Start, Finish, Ono, OName) Pno  ? Rno  ? Rname  ? Rno, Start  ? Ono  ? Oname  ? PAddress  ? Each student gives one answer The table keeps all records, past, current, and future

Keys Candidate Key? A minimum set of attributes that uniquely identifies each occurrence of an entity type. No proper subset satisfying the definition. Not minimum cardinality. Primary Key The candidate key that is selected to uniquely identify each occurrence of an entity type (table/relation). Alternate Key Candidate key that is not selected as the primary key still unique

Candidate Keys and FDs For all other attributes of a table Candidate Key  All PK  All AK All 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 trivial)

Partial FDs X, W  Y is partial if X  Y or W  Y Special case of trivial FD Example: Sno, Bno  Address, Phone Partial? Yes! Sno  Address, Phone

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

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!) A  B B  C A  C (you can have this one on A51)

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

Transitive FDs A B C 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!

Due Friday, February 23 At 5 PM Assignment 5-1 Due Friday, February 23 At 5 PM Could discuss Assignment 4