1 Section 14 - Subtypes/Supertypes u Subtyping –allows our diagram to show several different options at the same time –is useful for concisely representing.

Slides:



Advertisements
Similar presentations
Author: Graeme C. Simsion and Graham C. Witt Chapter 7 Extensions and Alternatives.
Advertisements

Author: Graeme C. Simsion and Graham C. Witt Chapter 6 Primary Keys and Identity.
Author: Graeme C. Simsion and Graham C. Witt Chapter 4 Subtypes & Supertypes.
Database Systems: Design, Implementation, and Management Tenth Edition
Advanced Data Modeling
Copyright Irwin/McGraw-Hill Data Modeling Prepared by Kevin C. Dittman for Systems Analysis & Design Methods 4ed by J. L. Whitten & L. D. Bentley.
Entity Relationship (ER) Modeling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
IT420: Database Management and Organization
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 6 Advanced Data Modeling.
Database Systems: Design, Implementation, and Management Tenth Edition
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 6 Advanced Data Modeling.
Design Principles: Faithfulness
Design Principles: Faithfulness
Concepts of Database Management Sixth Edition
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 COS 346 Day 6.
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 6 Developing Data Models for Business Databases.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
Concepts of Database Management Seventh Edition
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 6 Developing Data Models for Business Databases.
Systems Analysis I Data Flow Diagrams
File and Database Design; Logic Modeling Class 24.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Using ER/Studio.
Logical Database Design Nazife Dimililer. II - Logical Database Design Two stages –Building and validating local logical model –Building and validating.
Database Design.  Define a table for each entity  Give the table the same name as the entity  Make the primary key the same as the identifier of the.
 An entity-relationship (ER) diagram is a specialized graphic that illustrates the interrelationships between entities in a database.  An Entity Relationship.
Class Agenda – 04/04/2006 Discuss database modeling issues
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.
Chapter 4 The Relational Model.
An Investigation of Oracle and SQL Server with respect to Integrity, and SQL Language standards Presented by: Paul Tarwireyi Supervisor: John Ebden Date:
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Database Systems: Design, Implementation, and Management Ninth Edition
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 2 This material was developed by Oregon Health & Science.
Chapter 8 Data Modeling Advanced Concepts Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
1 Relational Databases and SQL. Learning Objectives Understand techniques to model complex accounting phenomena in an E-R diagram Develop E-R diagrams.
M1G Introduction to Database Development 2. Creating a Database.
Concepts of Database Management Sixth Edition Chapter 6 Database Design 2: Design Method.
Database Design, Application Development, and Administration, 5 th Edition Copyright © 2011 by Michael V. Mannino All rights reserved. Chapter 6 Developing.
Next Back A-1 Management Information Systems for the Information Age Second Canadian Edition Copyright 2004 The McGraw-Hill Companies, Inc. All rights.
C-1 Management Information Systems for the Information Age Copyright 2004 The McGraw-Hill Companies, Inc. All rights reserved Extended Learning Module.
CSC271 Database Systems Lecture # 25. Summary: Previous Lecture  Structural constraints  Multiplicity  Cardinality  Participation  Connection traps.
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.
Component 4/Unit 6b Topic II Relational Databases Keys and relationships Data modeling Database acquisition Database Management System (DBMS) Database.
Database Design Sections 11 Database relationship, Integrity, keys, mapping conceptual model to logical/physical model Previous Section 12 – DDLesson11Fa12.ppt.
Database Design Sections 11 & 12 drawing conventions, generic model, integrity, keys, mapping conceptual model to logical/physical model.
Chapter 9 Logical Database Design : Mapping ER Model To Tables.
1 6 Concepts of Database Management, 5 th Edition, Pratt & Adamski Chapter 6 Database Design 2: Design Methodology Spring 2006.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
The relational model A data model (in general) : Integrated collection of concepts for describing data (data requirements). Relational model was introduced.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 4 Introduction to a First Course in Database Systems.
Entity Relationship Diagram (ERD). Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship.
Chapter 3: Relational Databases
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Five: Data Modeling with the Entity-Relationship.
Data Modeling Advanced Concepts Updated 20/4/2015 TMC2034 Database Concept and Design1.
BTM 382 Database Management Chapter 5: Advanced Data Modeling
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
1 Entity Relationship Approach u Top-down approach to data modeling u Uses diagrams u Normalization - confirms technical soundness u Entity Relationship.
Lecture # 14 Chapter # 5 The Relational Data Model and Relational Database Constraints Database Systems.
Logical Database Design and the Rational Model
Business System Development
Data Modelling Introduction
Presentation transcript:

1 Section 14 - Subtypes/Supertypes u Subtyping –allows our diagram to show several different options at the same time –is useful for concisely representing rules and constraints, and for managing complexity

2 Levels of Generalization u What data would we need to store to record family trees? –fathers –mothers »their marriages –children u Graphic 4-1

3 Marriage Entity u Is the resolution of... –Person to Person in Figure A –Man and Woman in Figure B u Marriage is Many-to-Many –Because people may marry more than one person in their lifetime »Usually not concurrently!

4 Optional Parents? u “mother of” and “father of” are optional relationships. Why? u Doesn’t everyone have to have a Father and a Mother?

5 Reality vs. Data u The rule that everyone must have a mother seems reasonable, but... u... we cannot identify all the mothers from historical data –We will run out of data long before we need to face the problem of “who was the first woman?”

6 Choice of Entities u Why can’t we use “mother”, “father”, “child” as entities?

7 Nonredundancy u Since a person can be both a mother and a child we would compromise our objective of nonredundancy if we carried the same data about a person in two tables u Graphic 4-1 shows two different approaches to the problem –Person Concept –Nonoverlapping concepts of man and woman

8 Differences u The level of generalization is the difference between the two models –Person is a generalization of Man and Woman –Man and Woman are a specialization of Person u More... –Specializing Man into Married Man and Unmarried Man –Generalizing Marriage into Personal Relationships

9 Profound Effect u The choice of level of generalization will have a profound effect on... –the database –the total system u Obvious effect is to reduce the number of entities which will... –Reduce system complexity, through generalization program logic OR... –Increase complexity if the logic needed to handle different subtypes outweighs the gains

10 Selecting the Appropriate Level u Start by looking at an important difference between the models: the number and type of rules (constraints) that each supports. –Man-Woman model has three entities and six relationships –Person model has two entities and four relationships

11 More Differences... u Insists that a marriage consists of one man and one woman u Person model would allow same-sex offspring. –Note: We could enforce this rule in the program logic

12 Stability Criteria u The more constraints the data model enforces, the more likely that one of more of them will change u This makes are model less stable

13 Rules for Generalization u Don’t build a rule into the data structure of a system unless you are reasonably sure the rule will remain in force for the life of the system u Use generalization to remove unwanted rules from the data model

14 Don’t Overdo It u Very general models can seem virtually immune to criticism, on the basis that they accommodate almost anything! u This is NOT brilliant data modeling, but an abdication of design in favor of the function modeler, or the user, who will have to pick up all the business rules missed

15 Representing Subtypes/Supertypes u As we generalize the model it is good not to “lose” the rules we have gathered –e.g If we use the Person model we want to save the “man and woman in a marriage” rule u Even if we don’t implement the rules in the data model, we can pass them on to the function modeler

16 Deferring Generalization u Need a diagramming convention that will allow us to show both –Generalization –Specialization u Graphic 4-2

17 New Diagramming Convention u Box-in-Box –Adds complexity to our diagram –Adds another dimension (generalization/specialization) to our model u Using this convention is called “Subtyping”

18 Subtypes/Supertypes u Man and Women are subtypes of Person u Person is a supertype of Man and of Woman

19 Subtypes/Supertypes as Entities u 1.Use round-rectangle for subtypes and supertypes u 2.Subtypes and supertypes must be supported by definitions u 3. Subtypes and supertypes can have attributes (Common attributes on the supertype

20 Continued u 4. Subtypes and supertypes must have a primary key u 5. Subtypes and supertypes can participate in relationships (Notice in figure 4-2 how “mother-of” and “father-of” are tied to the appropriate level u 6. Subtypes themselves can have subtypes

21 Definition u An entity inherits the definition of its supertype –if the entity Job Position is subtyped into Permanent Position and Temporary Position then the definition of Permanent Position would begin with “a Job Position that...”

22 Attributes of Subtypes u Record attributes that can apply to all subtypes with the supertype –e.g. Record Date-of-Birth with the Person entity u Record attributes that can only apply to the subtype with the subtype –e.g. Record “maiden name” with the Woman entity –Constraint - “a woman can only have a maiden name”

23 Attributes Recorded at Both Levels u Sometimes can add meaning by representing attributes at two or more levels of generalization u For example, we might have an entity Contract, subtyped into Renewable Contract and Fixed-term Contract –subtypes might include Renewal Date and Expiration Date, respectively –supertype might generalize this attribute to End-Date

24 Primary Key u If Woman entity has woman_id as a primary key and Man entity has man_id as a primary key, then Person entity might have person_id plus a male/female flag as its primary key

25 Conversion to a Relational Model u When we started with a set of tables and drew an E-R diagram, we didn't show any supertypes –Relational notation does not support subtypes or supertypes u At the end of the modeling process, we must produce a subtype-free model –Called "leveling the model" –like Object-oriented

26 Choices u Can discard Person and keep Man and Woman entities –we will inherit the attributes from Person –must add a 'type' attribute u Or, keep Person and discard Man and Woman entity –we will roll-up the attributes from Man and Woman, these attributes become optional in Person (null values are permissible); some attributes may be combined

27 Rolling up Two or More Levels u Must choose how many "type" attributes to introduce –author suggests simply using a single "type" from the lowest level of subtyping –Graphic 4-3 u Need two "types" if you want to distinguish the levels –Graphic 4-4

28 A Third Option u We can implement all three entities as tables –Graphic 4-5 u Link the tables by carrying the foreign key of Person in the Man and Woman tables –Pro: We don't need to discard any of the previous concepts –Con: We may end up with a proliferation of tables... violating simplicity criteria

29 Using Views u Can use views to present data at the subtype or supertype level u Some limitations... –Not all views allow the data presented to be updated »restrictions of a DBMS »Ambiguously presented data (data combined from two or more tables)

30 What happens to Relationships? u We need to do something about relationships involving discarded entities –We inherit relationships from discarded supertypes –We roll-up relationships from discarded subtypes »Makes some relationships optional »May generalize a relationship

31 Examples u Graphic 4-6a u Graphic 4-6b u Graphic 4-6c

32 Nonoverlapping & Exhaustive u Subtypes are... –Nonoverlapping - a given person cannot be both a man and a woman –Exhaustive - a given person must be either a man or a woman, nothing else

33 Reality vs. What We Know u It may be true that all people are either a man or a woman, but our data may be incomplete –e.g. Terry is a parent of John, is Terry a man or a woman?

34 Summary u Subtypes and Supertypes can be used to specialize or generalize information u Diagrammatically represented as a box-in- box u Level the model as a final step for implementation u Subtypes must be Nonoverlapping and Exhaustive

35 Section 14 - Last Slide u End of Class! u Thank you