Download presentation
Presentation is loading. Please wait.
Published byDennis Bruce Modified over 9 years ago
1
IMS 6217: Relationships 1 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Database Design--Topics DB Design Steps Identify Relationships M:M Relationships
2
IMS 6217: Relationships 2 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Database Design Steps Identify “Information Elements” Identify Entities Identify Primary Keys Identify Relationships Fix Relationship Problems Identify Non-Key Attributes Fix Attribute Problems Address Performance Issues Build Application Objects (stored procedures, views) Design Reports List is not strictly sequential Some steps performed recursively Some steps require returning to previous steps
3
IMS 6217: Relationships 3 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Relationships "A meaningful association between (or among) entities" What in the world does this mean? Relationships indicate how entities interact from the organization's perspective Relationships will end up defining paths through the database along which data will be retrieved –The paths usually mirror real world associations between entities
4
IMS 6217: Relationships 4 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Relationships (cont.) While entities are nouns relationships are verbs –Buys, teaches, sells, owns, … –Is a –Has Relationship verb describes how two entities interact with each other If two entities do not interact (from the organization’s official viewpoint) then there is no relationship between them –Professor ?? Football_Play ‘Direction’ of verb is not very important Important special cases
5
IMS 6217: Relationships 5 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Relationships Exercise Connect all Related Entities From our List and Name the Relationships (do not apply cardinalities)
6
IMS 6217: Relationships 6 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Cardinality Understanding “Cardinality” is one of the most fundamentally important concepts in DB design Cardinality indicates how many occurrences of an entity must or may be allowed in the relationship with any one occurrence in the other entity Cardinality goes in each direction –One student may/must take ? Classes –One class must/may be taken by ? Students
7
IMS 6217: Relationships 7 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Cardinality (cont.) The cardinality at each end of a relationship specifies two elements –A maximum number of related records One (at most one) Many (an unconstrained number more than one) –A minimum number of related records Mandatory (at least one related record is required) Optional (no related record is required though one or many may exist)
8
IMS 6217: Relationships 8 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Cardinality Notation Mandatory One –One professor must have exactly one phone number Mandatory Many –A customer must have at least one purchase to be a customer but may have many Optional One –One professor may have as few as zero reserved parking spaces but may have only one at most Optional Many –One student may take as few as zero classes but may take more than one class
9
IMS 6217: Relationships 9 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Cardinality Notation (cont.) Interpret these cardinalities
10
IMS 6217: Relationships 10 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Cardinality Notation (cont.) Relationship cardinality is governed by the number of related occurrences you could have –If a student could have two majors then relationship is ‘Many’ on the Major side –May a car or house have more than one owner? –May an Employee be assigned to more than one job title at a time? –Will you record a Supplier if you do not currently carry any of their products? –Will you enter an Employee without assigning them to a position?
11
IMS 6217: Relationships 11 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Cardinality Notation (cont.) The graphical layout of a relationship is purely arbitrary
12
IMS 6217: Relationships 12 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Organization Policy and Cardinality Business policies (or regulations) may affect cardinality Identify legitimate business policies that support each of the different cardinality combinations reflected here
13
IMS 6217: Relationships 13 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Cardinality Exercise Apply Cardinalities to Each Relationship Identified in the Prior Step
14
IMS 6217: Relationships 14 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Foreign Keys Relationships are established when the Primary Key attribute(s) of one entity is/are found in another entity These attributes are called Foreign Keys in the other entity Foreign Keys
15
IMS 6217: Relationships 15 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Many-to-Many Relationships Many-to-Many (M:N) relationships must be decomposed into a new entity and two relationships Carefully examine the cardinality of the two new relationships
16
IMS 6217: Relationships 16 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU M:M Relationship Exercise Decompose M:M Relationships From the Previous Exercise
17
IMS 6217: Relationships 17 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Foreign Key Exercise Place Appropriate Foreign Keys In All Child Entities Found in the Previous Exercise
18
IMS 6217: Relationships 18 Dr. Lawrence West, MIS Dept., University of Central Florida LWEST@BUS.UCF.EDU Other Problems Exercise Fix Other Problems Found in the Previous Exercise Ternary or n-ary relationships Attributes on relationships (probably none yet) Unary M:M relationships
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.