IMS 4212: Introduction to Data Modeling—Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Relationships—Topics.

Slides:



Advertisements
Similar presentations
Chapter # 4 BIS Database Systems
Advertisements

Chapter 2.1 V3.1 Napier University Dr Gordon Russell
BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Entity Relationship (ER) Modeling
Entity Relationship (ER) Modeling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Entity Relationship (ER) Modeling
Entity-Relationship Model
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 COS 346 Day 6.
Entity-Relation Modeling Hun Myoung Park, Ph.D., Public Management and Policy Analysis Program Graduate School of International Relations International.
Database Design & Mapping
Information Resources Management January 30, 2001.
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Entity-Relationship Model
APPENDIX C DESIGNING DATABASES
Introduction to Databases
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 David M. Kroenke’s Chapter Five: Data Modeling with the Entity-Relationship.
DeSiamorewww.desiamore.com/ifm1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1. 2 Data Modeling 3 Process of creating a logical representation of the structure of the database The most important task in database development E-R.
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Chapter 5 Entity Relationship (ER) Modelling
Chapter 5 Entity–Relationship Modeling
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
IS 325 Notes for Wednesday September 4, Syllabus Change I eliminated quizzes I increased the points allocated to homework assignments.
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
DATABASEMODELSDATABASEMODELS  A database model ◦ defines the logical design of data. ◦ Describes the relationships between different parts of data.
IMS 6217: Relationships 1 Dr. Lawrence West, MIS Dept., University of Central Florida Database Design--Topics DB Design Steps Identify.
Database Design Principles – Lecture 3
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
© Pearson Education Limited, Chapter 7 Entity-Relationship modeling Transparencies.
IMS 4212: Data Modeling—Attributes 1 Dr. Lawrence West, Management Dept., University of Central Florida Attributes and Domains Nonkey.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall, modified by Dr. Lyn Mathis 5-1 David M. Kroenke’s, 10 th ed. Chapter.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
Chapter 12 Entity-Relationship Modeling Pearson Education © 2009.
IMS 4212: Data Modeling—More Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Data Modeling—Topics.
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
1 6 Concepts of Database Management, 5 th Edition, Pratt & Adamski Chapter 6 Database Design 2: Design Methodology Spring 2006.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
Chapter 8 Entity-Relationship Modeling Pearson Education © 2009.
2 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Data Models Why data models are important About the basic data-modeling.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Five: Data Modeling with the Entity-Relationship.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 2: MODELING DATA.
IMS 6217: Introduction to Data Modeling 1 Dr. Lawrence West, MIS Department, University of Central Florida Introduction to Data Modeling—Topics.
Entity Relationship (E-R) Model
Logical Database Design and the Rational Model
Tables and Their Characteristics
Overview of Entity‐Relationship Model
Entity-Relation Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Database Modeling using Entity Relationship Model (E-R Model)
Review of Week 1 Database DBMS File systems vs. database systems
Relationships—Topics
Relationships—Topics
Entity-Relationship Diagram (ERD)
Entity Relationship (ER) Modeling
Relationships—Topics
Presentation transcript:

IMS 4212: Introduction to Data Modeling—Relationships 1 Dr. Lawrence West, Management Dept., University of Central Florida Relationships—Topics Goal of the Relational Data Model Introducing Relationships Relationship Notation Schemes Binary Relationships Relationship Cardinality & Notation Policy and Cardinality Recursive (Unary) Relationships Ternary Relationships Relationships with Attributes The Road Ahead

IMS 4212: Introduction to Data Modeling—Relationships 2 Dr. Lawrence West, Management Dept., University of Central Florida The Goal of the Relational Data Model Recall that entities hold data about one type of object or event of interest to the organization A goal of the relational data model is to minimize the amount of stored data subject to: –Necessity to record data needed by the organization –Necessity to maintain relationships

IMS 4212: Introduction to Data Modeling—Relationships 3 Dr. Lawrence West, Management Dept., University of Central Florida The Goal of the Relational Data Model (cont). Data minimization is achieved by removing any redundant data –Achieved through good entity and relationship design –Normalization Our approach –Design properly normalized (minimal redundancy) data structures –Selectively denormalize (introduce redundancy) to improve performance

IMS 4212: Introduction to Data Modeling—Relationships 4 Dr. Lawrence West, Management Dept., University of Central Florida The Goal of the Relational Data Model (cont). DB design results in many tables, sometimes for simple organizational needs –Identifying entities from information requirements analysis –Creating new entities to fix attribute-level and relationship problems (covered soon) Relationships between tables enable us to reconnect data that is dispersed into many tables

IMS 4212: Introduction to Data Modeling—Relationships 5 Dr. Lawrence West, Management Dept., University of Central Florida 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

IMS 4212: Introduction to Data Modeling—Relationships 6 Dr. Lawrence West, Management Dept., University of Central Florida 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

IMS 4212: Introduction to Data Modeling—Relationships 7 Dr. Lawrence West, Management Dept., University of Central Florida Introducing Relationships Relationships are defined in three ways –In data modeling by conceptually identifying and documenting the fact that two entities do relate to each other –In data modeling by identifying shared attributes between the two entities –In the physical database by implementing common attributes and declaring the relationship

IMS 4212: Introduction to Data Modeling—Relationships 8 Dr. Lawrence West, Management Dept., University of Central Florida Introducing Relationships (cont.) Relationships are the glue that connects different stored data in a way that meets the organization’s needs File-based vs. Relational systems –In file-based systems each transaction record had all necessary data stored with it, including redundant copies of data –In relational systems only data of a particular type is stored in each entity (table)—little redundancy Relationships allow the system to reconstruct the logic of a transaction

IMS 4212: Introduction to Data Modeling—Relationships 9 Dr. Lawrence West, Management Dept., University of Central Florida Introducing Relationships (cont.) We deal with relationships in three ways –Modeling relationships as part of a process of discovery of the organization’s structure, etc –Adapting or correcting the relationships we find into the form required for database implementation –Implementing the relationships in the physical database

IMS 4212: Introduction to Data Modeling—Relationships 10 Dr. Lawrence West, Management Dept., University of Central Florida Two Notation Schemes (Chen LDM) Entities are indicated by a box with the entity name inside Attributes are listed in ovals attached to entities Relationships are indicated by diamonds Relationships are connected to entities by notation to indicate the cardinality of the relationship

IMS 4212: Introduction to Data Modeling—Relationships 11 Dr. Lawrence West, Management Dept., University of Central Florida Two Notation Schemes (Alternative LDM) Entities shown as boxes Entity name Attributes Relationship shown without the diamond

IMS 4212: Introduction to Data Modeling—Relationships 12 Dr. Lawrence West, Management Dept., University of Central Florida Binary Relationships The most commonly found relationship is between two entities (binary) Entities Relationship Cardinality Chen Diagram My Approach

IMS 4212: Introduction to Data Modeling—Relationships 13 Dr. Lawrence West, Management Dept., University of Central Florida 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

IMS 4212: Introduction to Data Modeling—Relationships 14 Dr. Lawrence West, Management Dept., University of Central Florida Relationship Cardinality (cont.) The measure of cardinality has two components at each end of the relationship: –A maximum (usually either 1 or an unconstrained number greater than one, referred to as “many”) –A minimum (usually either 0 or 1 but other values are possible, though rare) Relationship is mandatory if at least one matching record is required (minimum is 1) Relationship is optional if a matching record is not required (minimum is 0)

IMS 4212: Introduction to Data Modeling—Relationships 15 Dr. Lawrence West, Management Dept., University of Central Florida 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

IMS 4212: Introduction to Data Modeling—Relationships 16 Dr. Lawrence West, Management Dept., University of Central Florida Cardinality Notation (cont.) Interpret these cardinalities

IMS 4212: Introduction to Data Modeling—Relationships 17 Dr. Lawrence West, Management Dept., University of Central Florida 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?

IMS 4212: Introduction to Data Modeling—Relationships 18 Dr. Lawrence West, Management Dept., University of Central Florida Cardinality Notation (cont.) Commonly used verbal shorthand ignores the minimum component of a relationship 1:M (one-to-many) 1:1 (one-to-one) M:M (or M:N) (many-to-many)

IMS 4212: Introduction to Data Modeling—Relationships 19 Dr. Lawrence West, Management Dept., University of Central Florida Cardinality Notation (cont.) The graphical layout of a relationship is purely arbitrary

IMS 4212: Introduction to Data Modeling—Relationships 20 Dr. Lawrence West, Management Dept., University of Central Florida 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

IMS 4212: Introduction to Data Modeling—Relationships 21 Dr. Lawrence West, Management Dept., University of Central Florida Store Employee Sale Product EmployeeShift Department

IMS 4212: Introduction to Data Modeling—Relationships 22 Dr. Lawrence West, Management Dept., University of Central Florida Unary Relationships Unary relationships are relationships between an entity and itself –One employee supervises many other employees; each employee is supervised by, at most, one other employee –One part is a component of many other parts; One part (assembly) contains many other parts

IMS 4212: Introduction to Data Modeling—Relationships 23 Dr. Lawrence West, Management Dept., University of Central Florida Ternary Relationships A ternary relationship is one between three entities This relationship is for modeling and discovery only –Model the relationship the way the user describes it –Recognize that there are problems with implementing this relationship Relationship will be decomposed into multiple binary relationships for the final ERD –(What is the solution?)

IMS 4212: Introduction to Data Modeling—Relationships 24 Dr. Lawrence West, Management Dept., University of Central Florida Attributes on Relationships The modeling process will sometimes produce attributes of relationships These also will be eliminated in the final ERD –(What is the solution?) Look for the missing entity and implement it now

IMS 4212: Introduction to Data Modeling—Relationships 25 Dr. Lawrence West, Management Dept., University of Central Florida Multiple Relationships Sometimes there can be two relationships between the same two entities

IMS 4212: Introduction to Data Modeling—Relationships 26 Dr. Lawrence West, Management Dept., University of Central Florida Implementing Relationships Relationships are implemented by sharing attributes between entities When the Identifier Attribute of one entity appears as an attribute in another entity set a relationship is established (whether you intended it or not) These shared identifier attributes are called foreign keys (more next time) Identifier Attribute Shared Identifier Attribute

IMS 4212: Introduction to Data Modeling—Relationships 27 Dr. Lawrence West, Management Dept., University of Central Florida Problem Relationships Ternary relationships, attributes on relationships, multiple relationships, and Many-to-Many relationships all have serious implementation problems What are they? What does the nature of the problem tell us about what we should do to fix it?

IMS 4212: Introduction to Data Modeling—Relationships 28 Dr. Lawrence West, Management Dept., University of Central Florida Next Time Parent and Child Relationships Strong & Weak Entities Time- and Space-Dependent Data Supertype/Subtype entity sets