Toronto CSC 340 - Lecture 14 - Entity Relationship Modelling (6 pages)

Previewing pages 1, 2 of 6 page document View the full content.
View Full Document

Lecture 14 - Entity Relationship Modelling



Previewing pages 1, 2 of actual document.

View the full content.
View Full Document
View Full Document

Lecture 14 - Entity Relationship Modelling

128 views


Pages:
6
School:
University of Toronto
Course:
Csc 340 - Information Systems Analysis and Design
Information Systems Analysis and Design Documents
Unformatted text preview:

University of Toronto University of Toronto Department of Computer Science Department of Computer Science The Entity Relationship Model Lecture 14 Entity Relationship Modelling Entity Relationship Schema Describes data requirements for a new information system Direct easy to understand graphical notation The Entity Relationship Model Translates readily to relational schema for database design Entities But more abstract than relational schema E g can represent an entity without knowing its properties Relationships comparable to UML class diagrams Attributes Constraining the instances Entities classes of objects with properties in common and an autonomous existence Cardinalities E g City Department Employee Purchase and Sale Identifiers An instance of an entity is an object in the class represented by the entity Generalization 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 Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 University of Toronto 1 Department of Computer Science E g the pair Johanssen Stockholm is an instance in the relationship Residence Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 University of Toronto 2 Department of Computer Science Example Instances for Exam Examples Exam Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 3 Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 4 1 University of Toronto University of Toronto Department of Computer Science What Does An E R Diagram Really Mean Course Meets Department of Computer Science Recursive Relationships Room Course and Room are entities an entity can have relationships with itself Their instances are particular courses eg CSC340F and rooms eg MB128 Meets is a relationship Its instances describe particular meetings Each meeting has exactly one associated course and room If the relationship is not symmetric need to indicate the two roles that the entity plays in the relationship Easterbrook 2004 Course instances Meets instances Room instances This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 University of Toronto 5 Department of Computer Science Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 University of Toronto Ternary Relationships Department of Computer Science AND XOR Relationships Contains Order Order This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 7 Easterbrook 2004 Part XOR Requests Easterbrook 2004 6 Service FilledBy Shipment Generates Invoice AND 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 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 8 2 University of Toronto University of Toronto Department of Computer Science Attributes Department of Computer Science Composite Attributes associates with each instance of an entity or relationship a value belonging to a set the domain of the attribute These group attributes of the same entity or relationship that have closely connected meanings or uses The domain determines the admissible values for the attribute Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 University of Toronto 9 Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 University of Toronto Department of Computer Science 10 Department of Computer Science Cardinalities Schema with Attributes 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 Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 11 Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 12 3 University of Toronto University of Toronto Department of Computer Science Cardinality Example Instantiating ER diagrams A course meets twice a week An ER diagram specifies what states are possible in the world being modeled 2 2 Course Course 2 2 A day can have an unlimited number of meetings Easterbrook 2004 0 40 Meets 0 N Room A room can have up to 40 meetings per week Day University of Toronto 13 Easterbrook 2004 Illegal Instantiations 0 40 Department of Computer Science Cardinalities of Attributes Meets 14 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 University of Toronto Department of Computer Science 2 2 0 40 Meets Room This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 Course Department of Computer Science 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 Room 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 manyto many relationships Surname License Perso n 0 N Owns 1 1 Car Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 15 Easterbrook 2004 This lecture adapted from chapter 5 of Atzeni et al Database Systems McGraw Hill 1999 Registration 16 4 University of Toronto Identifiers University of Toronto Department of Computer Science Notes on 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


View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Lecture 14 - Entity Relationship Modelling and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 14 - Entity Relationship Modelling and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?