Data Modeling Advanced Concepts Updated 20/4/2015 TMC2034 Database Concept and Design1.

Slides:



Advertisements
Similar presentations
THE EXTENDED ENTITY RELATIONSHIP MODEL (EERM)
Advertisements

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.
Advanced Data Modeling
Entity Relationship (ER) Modeling
Database Processing: Fundamentals, Design, and Implementation, 9/e by David M. KroenkeChapter 5/1 Copyright © 2004 Please……. No Food Or Drink in the class.
1 © Prentice Hall, 2002 Chapter 4: The Enhanced E-R Model and Business Rules Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
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 6 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 5 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter 6 Advanced Data Modelling
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 6 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 6 Advanced Data Modeling.
Chapter 5 Understanding Entity Relationship Diagrams.
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,
Entity Relationship (E-R) Modeling
Fundamentals, Design, and Implementation, 9/e Chapter 5 Database Design.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 5 Understanding Entity Relationship Diagrams.
IS 4420 Database Fundamentals Chapter 4: The Enhanced ER Model and Business Rules Leon Chen.
CS424 PK, FK, FD Normalization Primary and Foreign Keys Primary and foreign keys are the most basic components on which relational theory is based. Primary.
Chapter 4 Entity Relationship (E-R) Modeling
Chapter 3: The Enhanced E-R Model
1 Chapter 4: The Enhanced ER Model and Business Rules.
Enhanced Entity-Relationship Model (EER) 1. Enhanced-ER (EER) Model Concepts Includes all modeling concepts of basic ER Additional concepts: subclasses/superclasses,
 Keys are special fields that serve two main purposes: ◦ Primary keys are unique identifiers of the relation in question. Examples include employee numbers,
Class Agenda – 04/04/2006 Discuss database modeling issues
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
3 Chapter 3 Entity Relationship (E-R) Modeling Database Systems: Design, Implementation, and Management, Fifth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Tenth Edition Chapter 5 Advanced Data Modeling.
© 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,
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 Tenth Edition
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
Chapter 8 Data Modeling Advanced Concepts Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
IS 475/675 - Introduction to Database Design
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
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)
1 A Demo of Logical Database Design. 2 Aim of the demo To develop an understanding of the logical view of data and the importance of the relational model.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
1 The Enhanced Entity Relationship Diagrams (E-ERDs)
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
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.
Entity Relationship Modeling
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 6 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Ninth Edition
The Entity-Relationship Model, P. I R. Nakatsu. Data Modeling A data model is the relatively simple representation, usually graphic, of the structure.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Copyright © 2016 Pearson Education, Inc. Modern Database Management 12 th Edition Jeff Hoffer, Ramesh Venkataraman, Heikki Topi CHAPTER 3: THE ENHANCED.
Ch 05. Basic Symbols ( manino ). Cardinalities Cardinality Notation.
Chapter 5 Understanding Entity Relationship Diagrams.
Database Design, Application Development, and Administration, 6 th Edition Copyright © 2015 by Michael V. Mannino. All rights reserved. Chapter 5 Understanding.
BTM 382 Database Management Chapter 5: Advanced Data Modeling
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
LECTURE 4: Chapter 4: The Enhanced E-R Model
TMC2034 Database Concept and Design
Figure Specialization Hierarchy
Database Management System 1 (ITED123A)
CHAPTER 3: THE ENHANCED E-R MODEL
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Chapter 5 Advanced Data Modeling
Database Management system
Entity Relationship (ER) Modeling
Presentation transcript:

Data Modeling Advanced Concepts Updated 20/4/2015 TMC2034 Database Concept and Design1

Learning Objectives In this chapter, you will learn: About the extended entity relationship (EER) model How entity clusters are used to represent multiple entities and relationships The characteristics of good primary keys and how to select them How to use flexible solutions for special data-modeling cases TMC2034 Database Concept and Design2

Extended Entity Relationship Model (EERM) Result of adding more semantic constructs to the original entity relationship (ER) model EER diagram (EERD): Uses the EER model TMC2034 Database Concept and Design3

Entity Supertypes and Subtypes Entity supertype: Generic entity type related to one or more entity subtypes Contains common characteristics Entity subtype: Contains unique characteristics of each entity subtype Criteria to determine the usage There must be different, identifiable kinds of the entity in the user’s environment The different kinds of instances should each have one or more attributes that are unique to that kind of instance TMC2034 Database Concept and Design4

Specialization Hierarchy Depicts arrangement of higher-level entity supertypes and lower-level entity subtypes Relationships are described in terms of “is-a” relationships Subtype exists within the context of a supertype Every subtype has one supertype to which it is directly related Supertype can have many subtypes TMC2034 Database Concept and Design5

Specialization Hierarchy Provides the means to: Support attribute inheritance Define a special supertype attribute known as the subtype discriminator Define disjoint/overlapping constraints and complete/partial constraints TMC2034 Database Concept and Design6

Figure Specialization Hierarchy TMC2034 Database Concept and Design7

Inheritance Enables an entity subtype to inherit attributes and relationships of the supertype All entity subtypes inherit their primary key attribute from their supertype At the implementation level, supertype and its subtype(s) maintain a 1:1 relationship Entity subtypes inherit all relationships in which supertype entity participates Lower-level subtypes inherit all attributes and relationships from its upper-level supertypes TMC2034 Database Concept and Design8

Subtype Discriminator Attribute in the supertype entity that determines to which entity subtype the supertype occurrence is related Default comparison condition is the equality comparison TMC2034 Database Concept and Design9

Disjoint and Overlapping Constraints Disjoint subtypes: Contain a unique subset of the supertype entity set Known as nonoverlapping subtypes Implementation is based on the value of the subtype discriminator attribute in the supertype Overlapping subtypes: Contain nonunique subsets of the supertype entity set Implementation requires the use of one discriminator attribute for each subtype TMC2034 Database Concept and Design10

Figure Specialization Hierarchy with Overlapping Subtypes TMC2034 Database Concept and Design11

Table Discriminator Attributes with Overlapping Subtypes TMC2034 Database Concept and Design12

Completeness Constraint Specifies whether each supertype occurrence must also be a member of at least one subtype Types Partial completeness: Not every supertype occurrence is a member of a subtype Total completeness: Every supertype occurrence must be a member of any subtype TMC2034 Database Concept and Design13

Table Specialization Hierarchy Constraint Scenarios TMC2034 Database Concept and Design14

Specialization and Generalization Specialization Top-down process Identifies lower-level, more specific entity subtypes from a higher-level entity supertype Based on grouping unique characteristics and relationships of the subtypes Generalization Bottom-up process Identifies a higher-level, more generic entity supertype from lower-level entity subtypes Based on grouping common characteristics and relationships of the subtypes TMC2034 Database Concept and Design15

Entity Cluster Virtual entity type used to represent multiple entities and relationships in ERD Avoid the display of attributes to eliminate complications that result when the inheritance rules change TMC2034 Database Concept and Design16

Figure Tiny College ERD Using Entity Clusters TMC2034 Database Concept and Design17

Primary Keys Single attribute or a combination of attributes, which uniquely identifies each entity instance Guarantees entity integrity Works with foreign keys to implement relationships TMC2034 Database Concept and Design18

Natural Keys or Natural Identifier Real-world identifier used to uniquely identify real- world objects Familiar to end users and forms part of their day-to-day business vocabulary Also known as natural identifier Used as the primary key of the entity being modeled TMC2034 Database Concept and Design19

Desirable Primary Key Characteristics Non intelligentNo change over timePreferably single-attributePreferably numericSecurity-compliant TMC2034 Database Concept and Design20

Use of Composite Primary Keys Identifiers of composite entities Each primary key combination is allowed once in M:N relationship Identifiers of weak entities Weak entity has a strong identifying relationship with the parent entity TMC2034 Database Concept and Design21

Use of Composite Primary Keys When used as identifiers of weak entities, represent a real-world object that is: Existence-dependent on another real-world object Represented in the data model as two separate entities in a strong identifying relationship TMC2034 Database Concept and Design22

Figure The M:N Relationship between STUDENT and CLASS TMC2034 Database Concept and Design23

Surrogate Keys Primary key used to simplify the identification of entity instances are useful when: There is no natural key Selected candidate key has embedded semantic contents or is too long Require ensuring that the candidate key of entity in question performs properly Use unique index and not null constraints TMC2034 Database Concept and Design24

Table Data Used to Keep Track of Events TMC2034 Database Concept and Design25

Data Used to Keep Track of Events PK (Date, Time_Start, ROOM) Resouce(R_ID, R_Description, R_TYPE, R_QTY, R_PRICE) M:N, Resource and Event. Event_Resource(Date, Time_Start, ROOM, R_ID, R_QTY) TMC2034 Database Concept and Design26

Design Case 1: Implementing 1:1 Relationships Foreign keys work with primary keys to properly implement relationships in relational model Rule Put primary key of the parent entity on the dependent entity as foreign key Options for selecting and placing the foreign key: Place a foreign key in both entities Place a foreign key in one of the entities TMC2034 Database Concept and Design27

Table Selection of Foreign Key in a 1:1 Relationship TMC2034 Database Concept and Design28

Figure The 1:1 Relationship between Department and Employee TMC2034 Database Concept and Design29

Design Case 2: Maintaining History of Time-Variant Data Time-variant data: Data whose values change over time and for which a history of the data changes must be retained Requires creating a new entity in a 1:M relationship with the original entity New entity contains the new value, date of the change, and other pertinent attribute TMC2034 Database Concept and Design30

Figure Maintaining Salary History TMC2034 Database Concept and Design31

Figure Maintaining Manager History TMC2034 Database Concept and Design32

Figure Maintaining Job History TMC2034 Database Concept and Design33

Design Case 3: Fan Traps Design trap: Occurs when a relationship is improperly or incompletely identified Represented in a way not consistent with the real world Fan trap: Occurs when one entity is in two 1:M relationships to other entities Produces an association among other entities not expressed in the model TMC2034 Database Concept and Design34

Figure Incorrect ERD with Fan Trap Problem TMC2034 Database Concept and Design35

Figure Corrected ERD After Removal of the Fan Trap TMC2034 Database Concept and Design36

Design Case 4: Redundant Relationships Occur when there are multiple relationship paths between related entities Need to remain consistent across the model Help simplify the design TMC2034 Database Concept and Design37

Figure A Redundant Relationship TMC2034 Database Concept and Design38