University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution.

Slides:



Advertisements
Similar presentations
the Entity-Relationship (ER) Model
Advertisements

Conceptual Data Modeling: ER
Entity-Relationship Model
Systems Development Life Cycle
Text-Book Chapters (7 and 8) Entity-Relationship Model
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 COS 346 Day 6.
System Analysis - Data Modeling
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Modeling Data The Entity Relationship Model (ER) For Database Design.
Chapter Five Data Modeling with the Entity-Relationship Model.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 5-1 COS 346 Day 6.
Fundamentals, Design, and Implementation, 9/e COS 346 Day 2.
Slides adapted from A. Silberschatz et al. Database System Concepts, 5th Ed. Entity-Relationship Model Database Management Systems I Alex Coman, Winter.
Systems Analysis and Design in a Changing World, 6th Edition
Entity-Relationship Model
Chapter Five Data Modeling with the Entity-Relationship Model.
Chapter 2: Entity-Relationship Model (Continued)
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
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.
CSE314 Database Systems Data Modeling Using the Entity- Relationship (ER) Model Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson Ed Slide Set.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
the Entity-Relationship Model
Computing & Information Sciences Kansas State University Wednesday, 01 Oct 2008CIS 560: Database System Concepts Lecture 15 of 42 Wednesday, 01 October.
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.
Dr. Mohamed Osman Hegaz1 Conceptual data base design: The conceptual models: The Entity Relationship Model.
Entities and Attributes
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
Chapter 5 Entity Relationship (ER) Modelling
Chapter 5 Entity–Relationship Modeling
1 ER Modeling BUAD/American University Entity Relationship (ER) Modeling.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 2/1 Copyright © 2004 Please……. No Food Or Drink in the class.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Systems Analysis and Design in a Changing World, 6th Edition 1 Chapter 4 Domain Classes.
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.
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Lecture 4 Conceptual Data Modeling. Objectives Define terms related to entity relationship modeling, including entity, entity instance, attribute, relationship,
DeSiamorePowered by DeSiaMore1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Computing & Information Sciences Kansas State University Wednesday, 24 Sep 2008CIS 560: Database System Concepts Lecture 12 of 42 Wednesday, 24 September.
Msigwaemhttp//:msigwaem.ueuo.com/1 Database Management Systems (DBMS)  B. Computer Science and BSc IT Year 1.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Databases Illuminated Chapter 3 The Entity Relationship Model.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
Entity Relationship Modeling
Data Modeling Using the Entity-Relationship (ER) Data Model (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
advanced data modeling
Lecture 03 Entity-Relationship Diagram. Chapter Outline.
DatabaseIM ISU1 Fundamentals of Database Systems Chapter 3 Data Modeling Using Entity-Relationship Model.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Chapter 4 Extended Entity-Relationship (EER)Model Incorporates Set-subset Relationships Incorporates Generalization Hierarchies Constraints: Coverage Constraints:
Data Modeling Using the Entity- Relationship (ER) Model.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
CHAPTER 13: OBJECT-ORIENTED DATA MODELING (OVERVIEW) Modern Database Management 11 th Edition Jeffrey A. Hoffer, V. Ramesh, Heikki Topi © 2013 Pearson.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module 8: Entity-Relationship.
David M. Kroenke and David J. Auer Database Processing Fundamentals, Design, and Implementation Chapter Five: Data Modeling with the Entity-Relationship.
Department of Mathematics Computer and Information Science1 CS 351: Database Management Systems Christopher I. G. Lanclos Chapter 4.
Enhanced Entity-Relationship and UML Modeling. 2.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 17 July 28,2012 Data Modeling using the Entity Relationship.
Data Modeling Using the Entity- Relationship (ER) Model
Comp 1100 Entity-Relationship (ER) Model
Chapter 7: Entity-Relationship Model
Outline of the ER Model By S.Saha
Database Systems Instructor Name: Lecture-9.
Review of Week 1 Database DBMS File systems vs. database systems
Database Processing: David M. Kroenke’s Chapter Five:
Chapter 6b: Database Design Using the E-R Model
Presentation transcript:

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1 Lecture 14: Entity Relationship Modelling Ü The Entity-Relationship Model  Entities  Relationships  Attributes Ü Constraining the instances  Cardinalities  Identifiers  Generalization

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 2 The Entity Relationship Model Ü Entity-Relationship Schema  Describes data requirements for a new information system  Direct, easy-to-understand graphical notation  Translates readily to relational schema for database design  But more abstract than relational schema  E.g. can represent an entity without knowing its properties  comparable to UML class diagrams Ü Entities:  classes of objects with properties in common and an autonomous existence  E.g. City, Department, Employee, Purchase and Sale  An instance of an entity is an object in the class represented by the entity  E.g. Stockholm, Helsinki, are examples of instances of the entity City Ü Relationships:  logical links between two or more entities.  E.g. Residence is a relationship that can exist between the City and Employee  An instance of a relationship is an n-tuple of instances of entities  E.g. the pair (Johanssen,Stockholm), is an instance in the relationship Residence.

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 3 Examples Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 4 Example Instances for Exam Exam Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5 Meets Course Room Course instances Room instances Meets instances What Does An ER Diagram Really Mean? Ü Course and Room are entities.  Their instances are particular courses (eg CSC340F) and rooms (eg MS2172) Ü Meets is a relationship.  Its instances describe particular meetings.  Each meeting has exactly one associated course and room Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 6 Recursive Relationships Ü An entity can have relationships with itself… Ü If the relationship is not symmetric…  …need to indicate the two roles that the entity plays in the relationship. Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 7 Ternary Relationships Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8 “Each Order either contains a part or requests a service, but not both” “For any given order, whenever there is at least one invoice there is also at least one shipment and vice versa” AND/XOR Relationships

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 9 Attributes Ü associates with each instance of an entity (or relationship) a value belonging to a set (the domain of the attribute).  The domain determines the admissible values for the attribute. Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 10 Composite Attributes Ü These group attributes of the same entity or relationship that have closely connected meanings or uses. Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 11 Schema with Attributes Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 12 Cardinalities Ü Cardinalities constrain participation in relationships  maximum and minimum number of relationship instances in which an entity instance can participate.  E.g. Ü cardinality is any pair of non-negative integers (a,b)  such that a≤b.  If a=0 then entity participation in a relationship is optional  If a=1 then entity participation in a relationship is mandatory.  If b=1 each instance of the entity is associated at most with a single instance of the relationship  If b=“N” then each instance of the entity is associated with an arbitrary number of instances of the relationship. Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13 Meets Course Room (2,2) Day (0,40) (0,N) “A course meets twice a week” “A room can have up to 40 meetings per week” “A day can have an unlimited number of meetings” Cardinality Example Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14 Meets Course Room (2,2) (0,40) Instantiating ER diagrams Ü An ER diagram specifies what states are possible in the world being modeled Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 15 Meets Course Room (2,2) (0,40) Instantiating ER diagrams Ü An ER diagram specifies what states are possible in the world being modeled Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999 Illegal Instantiations

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 16 Cardinalities of Attributes Ü Attributes can also have cardinalities  To describe the minimum and maximum number of values of the attribute associated with each instance of an entity or a relationship.  The default is (1,1)  Optional attributes have cardinality (0,1) Ü Multi-valued attribute cardinalities are problematic  Usually better modelled with additional entities linked by one-to-many (or many- to-many) relationships Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 17 Identifiers (also known as “keys”) Ü How to uniquely identify instances of an entity?  An identifier may formed by one or more attributes of the entity itself  If attributes of an entity are not sufficient to identify instances unambiguously, other entities can be involved in the identification  A relationships is identified using identifiers for all the entities it relates  E.g. the identifier for the relationship (Person-) Owns(-Car) is a combination of the Person and Car identifiers. internal, single-attribute internal, multi-attribute external, multi-attribute Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 18 Notes on Identifiers Ü Identifiers and cardinality:  An identifier can involve one or more attributes, provided that each has (1,1) cardinality  An external identifier can involve one or more entities, provided that each is a member of a relationship to which the entity to identify participates with cardinality (1,1) Ü Cycles  An external identifier can involve an entity that is in its turn identified externally, as long as cycles are not generated; Ü Multiple identifiers  Each entity must have at least one (internal or external) identifier  An entity can have more than one identifier  Note: if there is more than one identifier, then the attributes and entities involved in an identification can be optional (minimum cardinality equal to 0). Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 19 Schema with Identifiers Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 20 Understanding Identifier Choices Only one lecture for a given course at any given time Can’t have two sections of same course meeting at same time Only one lecture a week per course Each instructor can only give one lecture per week An instructor’s lectures must all be in different rooms

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 21 Generalizations Ü Show “is-a” relationships between entities Ü Inheritance:  Every instance of a child entity is also an instance of the parent entity  Every property of the parent entity (attribute, identifier, relationship or other generalization) is also a property of a child entity Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 22 Types of Generalizations Ü Total generalizations:  …every instance of the parent entity is an instance of one of its children  Shown as a solid arrow  (otherwise: Partial, shown as an unfilled arrow) Ü Exclusive generalizations:  …every instance of the parent entity is at most an instance of one of its children  (otherwise: overlapping) Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 23 The E-R Meta-Model (as an E-R Diagram) Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999

University of Toronto Department of Computer Science © Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 24 Summary: UML vs ERD Ü ER diagrams are similar to UML Class diagrams  Class diagrams emphasize class hierarchies and operations  ER diagrams emphasize relationships and identity But you only need one for any given problem analysis! Ü ER provides richer notation for database concepts:  ER diagrams allow N-ary relationships  (UML Class diagrams only allow binary relationships)  ER diagrams allow multi-valued attributes  ER diagrams allow the specification of identifiers Ü Choice may depend on implementation target:  Class diagrams for Object Oriented Architecture  ER diagrams for Relational Databases  But this only matters if you are using them for blueprints  For sketches, familiarity with notation is more important