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

Slides:



Advertisements
Similar presentations
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
Advertisements

Welcome to Who Wants to be a Millionaire
Slide 1 Insert your own content. Slide 2 Insert your own content.
Database Fundamentals
Chapter 1 The Study of Body Function Image PowerPoint
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 28.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 38.
Database Design: Normalization J.G. Zheng June 29 th 2005 DB Chapter 4.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
MULTIPLYING MONOMIALS TIMES POLYNOMIALS (DISTRIBUTIVE PROPERTY)
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
MULTIPLICATION EQUATIONS 1. SOLVE FOR X 3. WHAT EVER YOU DO TO ONE SIDE YOU HAVE TO DO TO THE OTHER 2. DIVIDE BY THE NUMBER IN FRONT OF THE VARIABLE.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
Addition Facts
Year 6 mental test 10 second questions Numbers and number system Numbers and the number system, fractions, decimals, proportion & probability.
Normal forms - 1NF, 2NF and 3NF
1 Term 2, 2004, Lecture 2, Normalisation - IntroductionMarian Ursu, Department of Computing, Goldsmiths College Normalisation Introduction.
Who Wants To Be A Millionaire? Decimal Edition Question 1.
£1 Million £500,000 £250,000 £125,000 £64,000 £32,000 £16,000 £8,000 £4,000 £2,000 £1,000 £500 £300 £200 £100 Welcome.
Welcome to Who Wants to be a Millionaire
CS 319: Theory of Databases
ZMQS ZMQS
$100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400 $100 $200 $300 $400.
Chapter 18 Methodology – Monitoring and Tuning the Operational System Transparencies © Pearson Education Limited 1995, 2005.
CS 3630 Database Design and Implementation. Where Clause and Aggregate Functions -- List all rooms whose price is greater than the -- average room price.
ITS232 Introduction To Database Management Systems
© S Haughton more than 3?
15. Oktober Oktober Oktober 2012.
5.9 + = 10 a)3.6 b)4.1 c)5.3 Question 1: Good Answer!! Well Done!! = 10 Question 1:
Chapter 16: Relational Database Design and Further Dependencies
Take from Ten First Subtraction Strategy -9 Click on a number below to go directly to that type of subtraction problems
Created by Susan Neal $100 Fractions Addition Fractions Subtraction Fractions Multiplication Fractions Division General $200 $300 $400 $500 $100 $200.
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
Functional Dependencies and Normalization for Relational Databases
Addition 1’s to 20.
25 seconds left…...
Equal or Not. Equal or Not
Slippery Slope
Test B, 100 Subtraction Facts
Week 1.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
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.
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 ( 更動異常.
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 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. 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.
Dr. Mohamed Osman Hegaz1 Logical data base design (2) Normalization.
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.
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
Chapter 14 Normalization
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
Boyce-Codd Normal Form (BCNF)
CS 3630 Database Design and Implementation
CS 3630 Database Design and Implementation
Chapter 14 Normalization.
Presentation transcript:

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

First Normal Form (1NF) No multi-value attributes Done when mapping E-R model to relational schema 2

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 the PK. 3

4 Partial FDs If X, W Y and X Y Then X, W Y is a partial FD Example: Sno, Bno staffAddress, staffPhone Sno staffAddress, staffPhone

5 Full FDs A FD is a full FD if its not partial. A, B X, Y is a full FD if A X, Y is false B X, Y is false Sno staffAddress, staffPhone Pno, Start Rno, Rent, End

Example Lease (RNo, RName, PNo, PAddress, Start, Finish, Rent, ONo, OName) Primary Key: PNo, Start Alternate Key: PNo, Finish PAddress, Start PAddress, Finish FDs: PNo, Start ---> All other attributes PNo, Finish ---> All other attributes PAddress, Start ---> All other attributes PAddress, Finish ---> All other attributes PNo ---> PAddress, ONo, OName (Partial on Primary Key) PAddress ---> PNo, ONo, OName RNo ---> RName ONo ---> Oname 6

Table Instance RNo RName PNo PAddress Start Finish Rent Ono OName R101 John P main O100 Tina R102 Mike P main O100 Tina R103 Kay P main O100 Tina R101 John P main O110 Tony R105 Scot P first O109 Tony PNo, Start ---> All other attributes (Partial on Primary Key) PNo ---> PAddress, ONo, OName Not in 2NF! Poor Performance Redundancy Inconsistency 7

Decompose Lease into 2NF Lease (RNo, RName, PNo, PAddress, Start, Finish, Rent, ONo, OName) Primary Key: PNo, Start Partial FD on Primary Key PNo ---> PAddress, ONo, OName Remove partial dependent on Primary Key Create a new relation Which attributes are in the new relation? All attributes in (both side of) the partial FD Lease1 (PNo, PAddress, ONo, OName) Which attributes are left in the original relation? PK remains the same Lease2 (RNo, RName, PNo, Start, Finish, Rent) PK and FK? 8

Lease1 (PNo, PAddress, ONo, OName) Primary Key: PNo Alternate Key: PAddress Foreign Key: None (from this conversion Functional Dependencies: PNo ---> All other attributes PAddress ---> PNo, ONo, OName ONo ---> OName In 2NF? Lease2 (RNo, RName, PNo, Start, Finish, Rent) Primary Key: PNo, Start Alternate Key: PNo, Finish Foreign Key: PNo references Lease1 Functional Dependencies: PNo, Start ---> All other attributes PNo, Finish ---> All other attributes RNo ---> Rname In 2NF? 9

Relation/Table Instances Lease Rno RName PNo PAddress Start Finish Rent Ono OName R101 John P main O100 Tina R102 Mike P main O100 Tina R103 Kay P main O100 Tina R101 John P main O110 Tony R105 Scot P first O109 Tony Lease1 PNo PAddress ONo OName P main O100 Tina P main O110 Tony P first O109 Tony Lease1 = PNo, PAddress, Ono, OName (Lease) 10

Removing Duplicates Lease1 PNo PAddress ONo OName P main O100 Tina P main O110 Tony P first O109 Tony Lease1 P main O100 Tina P main O110 Tony P first O109 Tony 11

Lease RNo RName PNo PAddress Start Finish Rent Ono OName R101 John P main O100 Tina R102 Mike P main O100 Tina R103 Kay P main O100 Tina R101 John P main O110 Tony R105 Scot P first O109 Tony Lease2 RNo RName PNo Start Finish Rent R101 John P R102 Mike P R103 Kay P R101 John P R105 Scot P Lease2 = RNo, RName, RNo, Start, Finish, Rent (Lease) 12

Some FDs are lost Lease (RNo, RName, PNo, PAddress, Start, Finish, Rent, ONo, OName) PAddress, Start ---> All other attributes PAddress, Finish ---> All other attributes Lease1 (PNo, PAddress, ONo, OName) Lease2 (RNo, RName, PNo, Start, Finish, Rent) 13

Example Relation R (A, B, C, D, E, F) Primary Key: A, B Alternate Key: None Foreign Key: None Functional Dependencies: A, B ---> All A ---> C B ---> E, F In 2NF? NO! 14

Table Instance A B C D E F 1 x cs se 1 y cs ee 2 x cs se 2 y cs ee Functional Dependencies: A, B ---> All A ---> C B ---> E, F 15

R1 (A, C) Primary Key: A Alternate Key: None Foreign Key: None Functional Dependencies: A ---> C R2 (B, E, F) Primary Key: B Alternate Key: None Foreign Key: None Functional Dependencies: B ---> E, F R3 (A, B, D) Primary Key: A, B Alternate Key: None Foreign Key: A References R1 B References R2 Functional Dependencies: A, B ---> D 16 R (A, B, C, D, E, F) Functional Dependencies: A, B ---> All A ---> C B ---> E, F Decompose table R into 2NF

Table Instance R A B C D E F 1 x cs se 1 y cs ee 2 x cs se 2 y cs ee R1 A C R2 B E F x cs se y cs ee R3 A B D 1 x y x y