HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts.

Slides:



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

LEUCEMIA MIELOIDE AGUDA TIPO 0
Database Design (3) IS 240 – Database Management Lecture #12 – Prof. M. E. Kabay, PhD, CISSP Norwich University
Working with MS-ACCESS IS 240 – Database Management Lecture #2 – Assoc. Prof. M. E. Kabay, PhD, CISSP Norwich University
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 5 Author: Julia Richards and R. Scott Hawley.
Copyright: ©2005 by Elsevier Inc. All rights reserved. 1 Author: Graeme C. Simsion and Graham C. Witt Chapter 3 The Entity-Relationship Approach.
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 4 Author: Julia Richards and R. Scott Hawley.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 38.
1 Chapter 40 - Physiology and Pathophysiology of Diuretic Action Copyright © 2013 Elsevier Inc. All rights reserved.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Database Design J.G. Zheng May 19 th Overview Entity Relationship Modeling Data modeling using Entity Relationship Diagram (ERD) Transforming.
Business Transaction Management Software for Application Coordination 1 Business Processes and Coordination.
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
Title Subtitle.
1.How long have you been married? 2.What is the best part about being married? 3.What is the most challenging part of being married? 4.How do you resolve.
Determine Eligibility Chapter 4. Determine Eligibility 4-2 Objectives Search for Customer on database Enter application signed date and eligibility determination.
List and Search Grants Chapter 2. List and Search Grants 2-2 Objectives Understand the option My Grants List Grant Screen Viewing a Grant Understand the.
0 - 0.
ALGEBRAIC EXPRESSIONS
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.
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.
FACTORING Think Distributive property backwards Work down, Show all steps ax + ay = a(x + y)
Addition Facts
RSA.
Introduction to Relational Database Systems 1 Lecture 4.
Introduction to SQL 1 Lecture 5. Introduction to SQL 2 Note in different implementations the syntax might slightly differ different features might be.
Relational data integrity
Normal forms - 1NF, 2NF and 3NF
1 Term 2, 2004, Lecture 2, Normalisation - IntroductionMarian Ursu, Department of Computing, Goldsmiths College Normalisation Introduction.
BALANCING 2 AIM: To solve equations with variables on both sides.
ZMQS ZMQS
Photo Composition Study Guide Label each photo with the category that applies to that image.
BT Wholesale October Creating your own telephone network WHOLESALE CALLS LINE ASSOCIATED.
Con Law Card Answers.
How To Use Google Forms to Create A Test Quick Easy Self-Graded!! Instant Reports.
Educational Video Planning Your Shots. Why? Beginning the Plan Read the script Find your location(s) Video production schedule Get cast member(s) Make.
ABC Technology Project
© Paradigm Publishing, Inc Access 2010 Level 1 Unit 1Creating Tables and Queries Chapter 2Creating Relationships between Tables.
Data Modeling. What are you keeping track of? You begin to develop a database by deciding what you are going to keep track of. Each thing that you are.
© S Haughton more than 3?
Twenty Questions Subject: Twenty Questions
Linking Verb? Action Verb or. Question 1 Define the term: action verb.
Squares and Square Root WALK. Solve each problem REVIEW:
Energy & Green Urbanism Markku Lappalainen Aalto University.
Graphing Ax + By = C Topic
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
Past Tense Probe. Past Tense Probe Past Tense Probe – Practice 1.
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
1 First EMRAS II Technical Meeting IAEA Headquarters, Vienna, 19–23 January 2009.
Addition 1’s to 20.
25 seconds left…...
Test B, 100 Subtraction Facts
11 = This is the fact family. You say: 8+3=11 and 3+8=11
Week 1.
We will resume in: 25 Minutes.
1 Unit 1 Kinematics Chapter 1 Day
New Rubrics? Create Assignment and Project Templates and Send the Assignments in Tk20 Must do before you can use updated rubrics Theresa Dorn.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Huiswerk Lees delen 3.2, 3.3 van hoofdstuk 3. opgaven voor hoofdstuk 2: modelleeropgave 5.
Lecture 9 Handling Many to Many Relationships INFO 1408 Database Design Concepts.
Lecture 9 Handling Many to Many Relationships INFO 1408 Database Design Concepts.
HNDComputing – DeMontfort University  DeMontfort University 2011 Database Fundamentals wk2 Database Design ConceptsDatabase Design Concepts Database Design.
Handling Many to Many Relationships. 2 Handling Many:Many Relationships Aims: To explain why M:M relationships cannot be implemented in relational database.
HNDComputing – DeMontfort University  DeMontfort University 2011 Entity Relationship Modelling (continued) wk4 Database Design ConceptsDatabase Design.
Presentation transcript:

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts Database Design Concepts IMAT1408 Lecture 5 Handling Many to Many relationships

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 2 Handling Many:Many Relationships Aims: –To demonstrate how to decompose many:many (M:M) relationships –To explain why M:M relationships need to be decomposed.

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 3 M:M Relationships A M:M relationship between 2 entity types must be decomposed into two 1:M relationships.

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 4 StudentModule chooses MM Becomes ModuleStudent Module Choice M M 1 1 makes is for

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 5 The Decomposition Rule A B r MM Becomes AB M M 1 1

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 6 Or - AB r MM Becomes AB M M1 1

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 7 Naming Naming the new entity type and the new relationships is sometimes not easy Often the old relationship name will help you name the new entity. In our example “chooses” became “choice” If all else fails, concatenate (join) the names of the 2 original entity types (e.g. Student Module).

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 8 Exercise Decompose this M:M relationship to form two 1:M relationships: Assign the new entity and relationship types suitable names. Doctor Patient examines M M

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 9 Solution Doctor Patient examines Patient at M 1 Appointment attends M 1

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 10 Identifiers We have seen that an entity must have an identifier The new entity type created by decomposition needs an identifier Start with a composite of the identifiers of the 2 original entity types –Need to consider carefully whether this will uniquely identify every occurrence of the new entity type.

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 11 Identifiers cont. For the second example: Doctor (doctor#,.... ) Patient (patient#,... ) So try Examination (doctor#, patient#, …..) Notice that doctor# and patient# are foreign keys (marked in bold type) as well as forming the new primary key Is this a suitable identifier?.

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 12 Identifiers cont. To decide if an identifier is suitable: Think of some other attributes for the entity Is one pair of doctor#, patient# values associated with just one value of each of these attributes?

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 13 Could a patient see the same doctor more than once? Examination (doctor#, patient#, ……………………..)

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 14 Could a patient see the doctor more than once in a day? Examination (doctor#, patient#, ………………………..)

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 15 This is getting a little complicated - maybe we should add a new key field: examination number Examination (examination#, doctor#, patient#, date, time,..) What does the underlining and bold type mean?

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 16 Why Decompose? Student(student#, name,...) Module(module#, description,...) How do we know which students are taking which modules? We don’t. StudentModule chooses MM Back to the first example Look at the original M:M relationship:

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 17 Why Decompose? cont. Decomposing gives us a new table: Student Module (student#, module#, ) Is this a suitable identifier ? Now we can list which student has chosen which module.

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 18 Exercise Actor (actor#, name,...) Film (film#, title,...) Decompose this M:M relationship Assign the new entity type an appropriate name and think of some additional attributes for it Assign the new entity type a suitable identifier. Actor Film appears in M M

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 19 Solution Actor Film Member of M 1 Cast List Actors in M 1

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 20 Summary We have looked at decomposition of M:M relationships Discussed how to identify a unique identifier.

HNDComputing – DeMontfort University  DeMontfort University 2011 Handling Many to Many relationships wk5 Database Design ConceptsDatabase Design Concepts 21 Reference Data Analysis for Database Design by D R Howe