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

1 Assignment 4 Map entities with relationships to relational schemas. Use DBDL to describe the table schemas.
Assignment Design Methodology A structured approach that uses procedures, techniques, tools, and documentation aids to support and facilitate the.
Boyce-Codd Normal Form (BCNF) Definition R in 1NF and Every determinant (the left side of a FD) is a candidate key. 1.
1 Database Systems: A Practical Approach to Design, Implementation and Management International Computer Science S. Carolyn Begg, Thomas Connolly Lecture.
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.
Chapter 6 Normalization 正規化. 6-2 In This Chapter You Will Learn:  更動異常  How tables that contain redundant data can suffer from update anomalies ( 更動異常.
Avoiding Database Anomalies
CSC271 Database Systems Lecture # 28.
Normalization Fundamentals of Database Systems. Lilac Safadi Normalization 2 Database Design Steps in building a database for an application: Real-world.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
1 CS 3630 Database Design and Implementation. 2 Sets Foundation of relational database. Basic Operations Power set Mapping.
11/07/2003Akbar Mokhtarani (LBNL)1 Normalization of Relational Tables Akbar Mokhtarani LBNL (HENPC group) November 7, 2003.
Chapter 13 Normalization © Pearson Education Limited 1995, 2005.
Chapter 13 Normalization Transparencies Last Updated: 08 th May 2011 By M. Arief
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.
CS 3630 Database Design and Implementation. Unnormalized Form (UNF) student courses John CS363 CS334 CS323 Multi-Value attribute Common in reports 2.
ITS232 Introduction To Database Management Systems Siti Nurbaya Ismail Faculty of Computer Science & Mathematics, Universiti Teknologi MARA (UiTM), Kedah.
Lecture9:Functional Dependencies and Normalization for Relational Databases Ref. Chapter Lecture9 1.
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.
IST Database Normalization Todd Bacastow IST 210.
Assignment 5–2 For each new relation, Use DBDL to specify the relation scheme Give the functional dependencies Give the corresponding relation instance.
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.
Understanding Data Storage
Functional Dependency and Normalization
SEEM3430: Information Systems Analysis and Design
CS 3630 Database Design and Implementation
Normalization DBMS.
A brief summary of database normalization
Normalization Dongsheng Lu Feb 21, 2003.
CS 3630 Database Design and Implementation
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
Normal Forms.
CS 3630 Database Design and Implementation
Advanced Normalization
Normalization Lecture 7 May Aldoayan.
Assignment 4 Map entities with relationships to relational schemas.
Chapter 14 Normalization
CS 3630 Database Design and Implementation
CHAPTER 5 Normalization Of Database Tables (Part II: The Process)
Assignment 5–2 For each table, Give a meaningful name
Normalization 2NF & 3NF Presented by: Dr. Samir Tartir
CS 3630 Database Design and Implementation
Entity relationship diagrams
Normalization.
CS 3630 Database Design and Implementation
Boyce-Codd Normal Form (BCNF)
Normalization.
Normalization and FD.
Normalization Dongsheng Lu Feb 21, 2003.
Chapter 7 Normalization Chapter 13 in Textbook.
Third Normal Form (3NF).
ITS232 Introduction To Database Management Systems
Normalization Dale-Marie Wilson, Ph.D..
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
Week of March th grade.
Normalization Edited by: Nada Alhirabi.
Chapter 14 Normalization.
Database Normalisation
Normalization of DB relations examples Fall 2015
Sampath Jayarathna Cal Poly Pomona
Sampath Jayarathna Cal Poly Pomona
Logical Data Modeling – Normalization
Chapter 7 Normalization Chapter 14 & 15 in Textbook.
Presentation transcript:

CS 3630 Database Design and Implementation

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. No Partial FDs on PK. Slides 2-5 copied from Note14 and should be removed after done Could keep all slides here! Enough time to answer all questions!

Lease (RNo, RName, PNo, PAddress, Start, Finish, Rent, ONo, OName) Primary Key: PNo, Start FDs: PNo, Start ---> RNo, RName, PAddress, Finish, Rent, ONo, OName PNo ---> PAddress, ONo, Oname (Partial on PK!) Lease1 (PNo, PAddress, ONo, OName) Primary Key: Pno Alternate Key: None Foreign Key: None PNo ---> PAddress, ONo, OName PAddress  Pno ONo ---> OName Lease2 (RNo, RName, PNo, Start, Finish, Rent) Foreign Key: PNo References Lease1 PNo, Start ---> RNo, RName, Finish, Rent RNo ---> RName

Better Name for the Two Tables Lease (RNo, RName, PNo, PAddress, Start, Finish, Rent, ONo, OName) Primary Key: PNo, Start Better Name for the Two Tables Lease1 (PNo, PAddress, ONo, OName) Primary Key: Pno Property Lease2 (RNo, RName, PNo, Start, Finish, Rent) Lease

Property (PNo, PAddress, ONo, OName) Primary Key: PNo FDs: PNo ---> PAddress, ONo, OName PAddress  PNo ONo ---> OName Table Instance PNo PAddress ONo OName P1001 1001 main O100 Tina P1002 2001 main O109 Tony P1009 1009 first O109 Tony P2009 2009 first O109 Tony In 2NF? But still some Redundancy Reason?

Third Normal Form (3NF) No Transitive FDs on PK. Relation R in 2NF, and No non-Primary-Key attribute is transitively functionally dependent on the primary key Then R is in 3NF. No Transitive FDs on PK.

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!)

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!

Property (PNo, PAddress, ONo, OName) FDs: Primary Key: PNo FDs: PNo ---> PAddress, ONo, OName PAddress ---> PNo ONo ---> OName Table Instance PNo PAddress ONo OName P1001 1001 main O100 Tina P1002 2001 main O109 Tony P1009 1009 first O109 Tony P2009 2009 first O109 Tony In 2NF, but still some redundancy Not in 3NF! PNo ---> ONo, Oname Ono --> Oname (Oname is transitively functionally dependent on Pno)

Decompose Property into 3NF Property (PNo, PAddress, ONo, OName) PNo ---> PAddress, ONo, OName PAddress ---> PNo ONo ---> OName Property1 (ONo, OName) Primary Key: Ono Alternate Keys: None Foreign Keys: ? FDs: ONo ---> Oname Property2 (PNo, PAddress, ONo) Primary Key: PNo Alternate Keys: PAddress Foreign Keys: ? FDs: PNo ---> PAddress, ONo PAddress  Pno

Decompose Property into 3NF Property (PNo, PAddress, ONo, OName) PNo ---> PAddress, ONo, OName PAddress ---> PNo ONo ---> OName Property1 (ONo, OName) Primary Key: Ono Alternate Keys: None Foreign Keys: None FDs: ONo ---> Oname Better table name? Owner Property2 (PNo, PAddress, ONo) Primary Key: PNo Alternate Keys: PAddress Foreign Keys: Ono references Property1 FDs: PNo ---> PAddress, ONo PAddress  Pno Better table name? Property

Decompose Property into 3NF Property (PNo, PAddress, ONo, OName) PNo ---> PAddress, ONo, OName PAddress ---> PNo ONo ---> OName Owner (ONo, OName) Primary Key: Ono Alternate Keys: None Foreign Keys: None FDs: ONo ---> Oname Property (PNo, PAddress, ONo) Primary Key: PNo Alternate Keys: PAddress Foreign Keys: Ono references Owner FDs: PNo ---> PAddress, ONo PAddress  Pno

Table Instances Property PNo PAddress ONo OName P1001 1001 main O100 Tina P1002 2001 main O109 Tony P1009 1009 first O109 Tony P2009 2009 first O109 Tony Property PNo PAddress Ono P1001 1001 main O100 P1002 2001 main O109 P1009 1009 first O109 P2009 2009 first O109 Owner ONo OName O100 Tina O109 Tony

Final Tables Lease Property Owner

Relation R R (A, B, C, D, E, F) Primary Key: A, B Alternate Keys: None Functional Dependencies: A, B ---> C, D, E, F C ---> D E ---> F Is it in 2NF? Is it in 3NF? How many tables we will have to decompose it into 3NF?

Exercise 3NF Table Instance A B C D E F 1 x 10 100 se 400 1 y 20 200 cis 1000 2 x 30 100 cis 1000 2 y 10 100 ct 400 A, B ---> C, D, E, F C ---> D E ---> F

Decompose R into 3NF R (A, B, C, D, E, F) PK: A, B AK: None FK: None FDs: A, B ---> C, D, E, F C ---> D E ---> F R3 (A, B, C, E) Primary Key: A, B Alternate Keys: None Foreign Key: C References R1 E References R2 Functional Dependencies: A, B ---> C, E R1 (C, D) Primary Key: C Alternate Keys: None Foreign Key: None Functional Dependencies: C ---> D R2 (E, F) Primary Key: E Alternate Keys: None Foreign Key: None Functional Dependencies: E ---> F

Table Instances R (A, B, C, D, E, F) A B C D E F 1 x 10 100 se 400 1 y 20 200 cis 1000 2 x 30 100 cis 1000 2 y 10 100 ct 400 R (A, B, C, E) A B C E 1 x 10 se 1 y 20 cis 2 x 30 cis 2 y 10 ct R1 (C, D) C D 10 100 20 200 30 100 R2 (E, F) E F se 400 cis 1000 ct 400

Assignment 5-2 Due Thursday, March 9 Quiz 2 Wednesday, March 8 Schedule Assignment 5-2 Due Thursday, March 9 Quiz 2 Wednesday, March 8