Modeling Relationships Farrokh Alemi, Ph.D. Updated by Janusz Wojtusiak, Fall 2009.

Slides:



Advertisements
Similar presentations
Chapter 4: The Enhanced ER Model and Business Rules
Advertisements

Chapter 3: The Enhanced E-R Model
Basic notation for supertype/subtype relationships
Chapter 3 The Enhanced E-R Model
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: The Enhanced E-R Model Modern Database Management 10 th Edition Jeffrey A. Hoffer,
Chapter 3  Define terms  Understand use of supertype/subtype relationships  Understand use of specialization and generalization techniques  Specify.
Chapter 3 © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 CHAPTER 4: THE ENHANCED E-R MODEL Modern Database Management 11 th Edition Jeffrey.
IT420: Database Management and Organization
Copyright © 2015 Pearson Education, Inc. Database Design Chapters 17 and
Concepts of Database Management Sixth Edition
Chapter 4 © 2005 by Prentice Hall 1 Objectives Definition of terms Definition of terms Use of supertype/subtype relationships Use of supertype/subtype.
Entity-Relationship Model and Diagrams (continued)
Chapter Five Data Modeling with the Entity-Relationship Model.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
Database Design Chapter 2. Goal of all Information Systems  To add value –Reduce costs –Increase sales or revenue –Provide a competitive advantage.
Concepts of Database Management Seventh Edition
IS 4420 Database Fundamentals Chapter 4: The Enhanced ER Model and Business Rules Leon Chen.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 10 Structuring.
Page 1 ISMT E-120 Introduction to Microsoft Access & Relational Databases The Influence of Software and Hardware Technologies on Business Productivity.
Chapter 3: The Enhanced E-R Model
Entity Relationship Diagram Farrokh Alemi Ph.D. Francesco Loaiza, Ph.D. J.D. Vikas Arya.
Oracle Academy -Week 1-.
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
Page 1 ISMT E-120 Desktop Applications for Managers Introduction to Microsoft Access.
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.
© 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 3: The Enhanced E-R Model Modern Database Management 10 th Edition Jeffrey A. Hoffer,
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Data Modelling – ERD Entity Relationship Diagram’s Entity Relationship Diagrams and how to create them. 1.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Rob and Coronel Adapted for INFS-3200.
Database Design Using Entity-Relationship Models Transformation of Entity-Relationship Models into Relational Database Design Trees, Networks, and Bills.
Data Modelling. ICT5 Introduction Historical development with most organisations Small-scale origins Individual computers bought for particular applications.
Implementing an REA Model in a Relational Database
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
Concepts of Database Management Sixth Edition Chapter 6 Database Design 2: Design Method.
Mass s Tailored to Individuals Farrokh Alemi, Ph.D.
Microsoft Access 2013 ®® Tutorial 9 Using Action Queries and Advanced Table Relationships.
Concepts of Database Management, Fifth Edition Chapter 6: Database Design 2: Design Methodology.
Database Management Systems MIT Lesson 02 – Database Design (Entity Relationship Diagram) By S. Sabraz Nawaz.
ERD ( Conceptual data model From the statement of data requirements a conceptual data model is produced. This describes.
Jozef Kuper.  Describe a Database  Entities  Atributes  Relationships.
In this session, you will learn to: Map an ER diagram to a table Objectives.
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
© 2011 Pearson Education 1 Chapter 3: Advanced Database Analysis Modern Database Management 10 th Edition, International Edition Jeffrey A. Hoffer, V.
CHAPTER 3: THE ENHANCED E-R MODEL © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey A. Hoffer,
Database Systems Supertypes and Subtypes Lecture # 10.
Supertypes and Subtypes
Database Systems ER Diagramming Tutor:Ian Perry Tel: Web:
Entity-Relationship Diagram Presentation Gianna-lee Williams 6AQ Ms. Anderson.
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
2 1 Database Systems: Design, Implementation, & Management, 7 th Edition, Rob & Coronel Data Models Why data models are important About the basic data-modeling.
Data Modeling (Entity Relationship Diagram) Farrokh Alemi, Ph.D. Updated by Janusz Wojtusiak (Fall 2009)
1 Information System Analysis Topic-3. 2 Entity Relationship Diagram \ Definition An entity-relationship (ER) diagram is a specialized graphic that illustrates.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 10 Structuring.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Appendix H: The Semantic Object Model.
IT 5433 LM2 ER & EER Model. Learning Objectives: Explain importance of data modeling Define and use the entity-relationship model Define E/R terms Describe.
Lecture 5 Data Model Design Jeffery S. Horsburgh Hydroinformatics Fall 2012 This work was funded by National Science Foundation Grant EPS
Data Modeling (Entity Relationship Diagram)
The Enhanced E-R Model and Business Rules
LECTURE 4: Chapter 4: The Enhanced E-R Model
Advanced Database Analysis
Chapter 4: The Enhanced E-R Model and Business Rules
Abstract descriptions of systems whose requirements are being analysed
Overview of Entity‐Relationship Model
Entity Relationship Diagrams
Relationships as Primary & Foreign Keys
Chapter 1: The Database Environment
MBA 664 Database Management
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management
Presentation transcript:

Modeling Relationships Farrokh Alemi, Ph.D. Updated by Janusz Wojtusiak, Fall 2009

Definition of Relationship Relationship describes the link between two entities Different words for the same idea – At the conceptual level (e.g. entities and their relationships) – At the physical level (tables, data classes and linkages)

Relationships A relationship is ALWAYS between two entities. – If you have three entities, you need at least two relationships to link them.

Relationships Are Identified Through Sentences A sentence containing the names of the two entities and a verb phrase in between. – Verb phrases: "has," "contains," "visits," "prescribes," "travels with," etc. – The two entities "Patient" and "Clinician" can be made into a sentence such as "A patient visits a clinician."

Relationships Revealed Is one of the entities a look up table used to provide menu items for an attribute of the other entity. Is one of the entities a subcategory to another. Do two entities share an attribute.

Relationships Documentation The name of first entity The name of second entity The verb phrase describing the relationship The cardinality of the relationship – one to one, one to many or many to many Business justification of the relationship, particularly its cardinality.

One-to-One Relationships This type of relationship often suggest that entities have been incorrectly designed Database designer must identify a good reason for using this type of relationship One-to-one relationships are used in specific situations, such as: – To avoid missing data – To model hierarchies – For privacy/security reason – To break very large tables if some fields are rarely accesses at the same time.

One-to-One Relationships This type of relationship in realized by using a common identifiers in both entities Employee EmployeeID FirstName LastName … EmployeeSecurity EmployeeID DateObtained SecurityLevel …

One-to-One Relationships More examples? Justification?

One-to-Many Relationships This is the most important type of relationship in relational databases They are used to represent all types of relationships in relational databases Relational databases are about one-to- many relationships Majority of relationships in databases are of this type.

One-to-Many Relationships One-to-Many relationships are represented by listing an identifier of “one” in “many” Employee EmployeeID FirstName LastName … EmployeeAddress AddressID EmployeeID DateObtained Level …

One-to-Many Relationships More examples?

Some Relationships Suggest New Entities Hierarchical Many to many relationships

Definition of Hierarchy A collection of super and sub entities. – A super entity is the broadest definition of several sub entities. – A sub entity is an entity that inherits its relationship from another entity.

Examples of Hierarchies Vehicles Organisms Drugs Parts of a complex device Any other examples?

Generalization & Specialization The process of abstracting from narrowly scoped terms into terms of broader scope is a generalization process Starting with a general term and narrowing its scope is a specialization process.

An Example of Generalization & Specialization

Hiearchy May Simplify Data Structures Specializations of the more general data class Person Oftentimes, introducing a subtype hierarchy can simplify the information model

Rules for Identifying Hierarchies Super-type is the broadest entity, should have all the attributes that are shared across the sub-entities. Each sub-entity should have an attribute that makes it different from other entities. – The attributes should be mutually exclusive.

Rules for Identifying Hierarchies

Confusion It may not be possible for sub types to unambiguously reside in one and only one of the subtypes specified in the hierarchy. – Refine further – If confusing, do not do it

Steps for Identifying a Hierarchy 1. Shared attributes 2. Discriminator attribute 3. Entity linkages at the super type level

Step two: Discriminator

Example

Step Three: Relations at Super Entity Level Reduces unnecessary relations – Simpler to read – Easier to implement

Advantages of Hierarchies Stabilize the overall model with respect to new requirements.

An example New Requirement: “Patient of record” becomes inactive but the system does not purge it

Insert a new entity in the hierarchy Include the new entity in the discriminator attribute Check that all sub entities are appropriately named

New Data Structure

Check Sub Entities The first issue is whether the sub entity is distinct form other entities

Check Super Entity Do the attributes in the super entity apply equally well to the new sub entity

Check Discriminator The third issue is whether the discriminator attribute in the super- entity applies to all sub types The importance of good entity and attribute definitions

Hierarchies Let’s work on some examples.

Many to Many Relationships

Example

Patient Clinician Association

Association Class Simplifies Resolve all many-to-many linkages A simpler way of capturing and tracking relationships In relational databases many-to-many relationships must be implemented through association classes.

Many-to-many relationships Examples: – Patient – clinician – Insurance company – patient – Nurse – bed – Can you give more examples?

Back to Hierarchies What happens if we have more than one role in a hierarchy?

Self Referral A Person to Person Association A self referring relationship is found in the same way as all relationships are found by making a sentence containing the name of the entity and a verb phrase.

Take Home Lessons 1. We saw that scenarios focus on decisions 2. Scenarios contain use cases which reveal the information exchange 3. Exchanges are used to specify fields 4. Business rules define relations 5. One-to-many is the most important type of relation.