SlideShare a Scribd company logo
1 of 23
Download to read offline
University of Toronto Department of Computer Science
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1
Lecture 12:
Entity Relationship Modelling
 The Entity-Relationship Model
 Entities
 Relationships
 Attributes
 Constraining the instances
 Cardinalities
 Identifiers
 Generalization
University of Toronto Department of Computer Science
© 2004-5 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
© 2004-5 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
© 2004-5 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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5
MeetsCourse Room
Course instancesCourse instances Room instancesRoom instances
Meets instancesMeets 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
© 2004-5 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
© 2004-5 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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8
““Each OrderEach Order
either contains aeither contains a
part or requestspart or requests
a service, but nota service, but not
bothboth””
““For any given order,For any given order,
whenever there is atwhenever there is at
least one invoiceleast one invoice
there is also at leastthere is also at least
one shipmentone shipment
and vice versaand vice versa””
AND/XOR Relationships
University of Toronto Department of Computer Science
© 2004-5 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
© 2004-5 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
© 2004-5 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
© 2004-5 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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13
MeetsCourse Room
(2,2)
Day
(0,40)
(0,N)
““A courseA course
meets twicemeets twice
a weeka week””
““A room canA room can
have up tohave up to
40 meetings40 meetings
per weekper week””
““A day canA day can
have anhave an
unlimitedunlimited
number ofnumber of
meetingsmeetings””
Cardinality Example
Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999
University of Toronto Department of Computer Science
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14
MeetsCourse 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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 15
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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 16
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-attributeexternal, multi-attribute
Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999
University of Toronto Department of Computer Science
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 17
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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 18
Schema with Identifiers
Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999
University of Toronto Department of Computer Science
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 19
Understanding Identifier Choices
University of Toronto Department of Computer Science
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 20
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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 21
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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 22
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
© 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 23
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

More Related Content

Similar to ER Modelling Concepts

Download
DownloadDownload
Downloadbutest
 
Download
DownloadDownload
Downloadbutest
 
Adaptive named entity recognition for social network analysis and domain onto...
Adaptive named entity recognition for social network analysis and domain onto...Adaptive named entity recognition for social network analysis and domain onto...
Adaptive named entity recognition for social network analysis and domain onto...Cuong Tran Van
 
Robustness in Machine Learning Explanations Does It Matter-1.pdf
Robustness in Machine Learning Explanations Does It Matter-1.pdfRobustness in Machine Learning Explanations Does It Matter-1.pdf
Robustness in Machine Learning Explanations Does It Matter-1.pdfDaniel983829
 
Semantic IoT Semantic Inter-Operability Practices - Part 1
Semantic IoT Semantic Inter-Operability Practices - Part 1Semantic IoT Semantic Inter-Operability Practices - Part 1
Semantic IoT Semantic Inter-Operability Practices - Part 1iotest
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docbutest
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docbutest
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docbutest
 
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution ManualData Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manualendokayle
 
Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)Imdad Ul Haq
 
Contextual Ontology Alignment - ESWC 2011
Contextual Ontology Alignment - ESWC 2011Contextual Ontology Alignment - ESWC 2011
Contextual Ontology Alignment - ESWC 2011Mariana Damova, Ph.D
 
Reasoning Over Knowledge Base
Reasoning Over Knowledge BaseReasoning Over Knowledge Base
Reasoning Over Knowledge BaseShubham Agarwal
 
Reasoning Over Knowledge Base
Reasoning Over Knowledge BaseReasoning Over Knowledge Base
Reasoning Over Knowledge BaseShubham Agarwal
 
A NAIVE METHOD FOR ONTOLOGY CONSTRUCTION
A NAIVE METHOD FOR ONTOLOGY CONSTRUCTIONA NAIVE METHOD FOR ONTOLOGY CONSTRUCTION
A NAIVE METHOD FOR ONTOLOGY CONSTRUCTIONijscai
 

Similar to ER Modelling Concepts (20)

Download
DownloadDownload
Download
 
Download
DownloadDownload
Download
 
Adaptive named entity recognition for social network analysis and domain onto...
Adaptive named entity recognition for social network analysis and domain onto...Adaptive named entity recognition for social network analysis and domain onto...
Adaptive named entity recognition for social network analysis and domain onto...
 
ER Diagram
ER DiagramER Diagram
ER Diagram
 
ER diagram - Krishna Geetha.ppt
ER diagram - Krishna Geetha.pptER diagram - Krishna Geetha.ppt
ER diagram - Krishna Geetha.ppt
 
Robustness in Machine Learning Explanations Does It Matter-1.pdf
Robustness in Machine Learning Explanations Does It Matter-1.pdfRobustness in Machine Learning Explanations Does It Matter-1.pdf
Robustness in Machine Learning Explanations Does It Matter-1.pdf
 
B017441015
B017441015B017441015
B017441015
 
D017422528
D017422528D017422528
D017422528
 
Semantic IoT Semantic Inter-Operability Practices - Part 1
Semantic IoT Semantic Inter-Operability Practices - Part 1Semantic IoT Semantic Inter-Operability Practices - Part 1
Semantic IoT Semantic Inter-Operability Practices - Part 1
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
 
A Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.docA Research Platform for Coevolving Agents.doc
A Research Platform for Coevolving Agents.doc
 
ppt
pptppt
ppt
 
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution ManualData Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
 
Datamodelling
DatamodellingDatamodelling
Datamodelling
 
Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)Enhance ERD(Entity Relationship Diagram)
Enhance ERD(Entity Relationship Diagram)
 
Contextual Ontology Alignment - ESWC 2011
Contextual Ontology Alignment - ESWC 2011Contextual Ontology Alignment - ESWC 2011
Contextual Ontology Alignment - ESWC 2011
 
Reasoning Over Knowledge Base
Reasoning Over Knowledge BaseReasoning Over Knowledge Base
Reasoning Over Knowledge Base
 
Reasoning Over Knowledge Base
Reasoning Over Knowledge BaseReasoning Over Knowledge Base
Reasoning Over Knowledge Base
 
A NAIVE METHOD FOR ONTOLOGY CONSTRUCTION
A NAIVE METHOD FOR ONTOLOGY CONSTRUCTIONA NAIVE METHOD FOR ONTOLOGY CONSTRUCTION
A NAIVE METHOD FOR ONTOLOGY CONSTRUCTION
 

More from marangburu42

Hennchthree 161102111515
Hennchthree 161102111515Hennchthree 161102111515
Hennchthree 161102111515marangburu42
 
Sequential circuits
Sequential circuitsSequential circuits
Sequential circuitsmarangburu42
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuitsmarangburu42
 
Hennchthree 160912095304
Hennchthree 160912095304Hennchthree 160912095304
Hennchthree 160912095304marangburu42
 
Sequential circuits
Sequential circuitsSequential circuits
Sequential circuitsmarangburu42
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuitsmarangburu42
 
Karnaugh mapping allaboutcircuits
Karnaugh mapping allaboutcircuitsKarnaugh mapping allaboutcircuits
Karnaugh mapping allaboutcircuitsmarangburu42
 
Aac boolean formulae
Aac   boolean formulaeAac   boolean formulae
Aac boolean formulaemarangburu42
 
Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858marangburu42
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinalmarangburu42
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinalmarangburu42
 
Mass storage structurefinal
Mass storage structurefinalMass storage structurefinal
Mass storage structurefinalmarangburu42
 
All aboutcircuits karnaugh maps
All aboutcircuits karnaugh mapsAll aboutcircuits karnaugh maps
All aboutcircuits karnaugh mapsmarangburu42
 
Virtual memoryfinal
Virtual memoryfinalVirtual memoryfinal
Virtual memoryfinalmarangburu42
 
Mainmemoryfinal 161019122029
Mainmemoryfinal 161019122029Mainmemoryfinal 161019122029
Mainmemoryfinal 161019122029marangburu42
 

More from marangburu42 (20)

Hol
HolHol
Hol
 
Write miss
Write missWrite miss
Write miss
 
Hennchthree 161102111515
Hennchthree 161102111515Hennchthree 161102111515
Hennchthree 161102111515
 
Hennchthree
HennchthreeHennchthree
Hennchthree
 
Hennchthree
HennchthreeHennchthree
Hennchthree
 
Sequential circuits
Sequential circuitsSequential circuits
Sequential circuits
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Hennchthree 160912095304
Hennchthree 160912095304Hennchthree 160912095304
Hennchthree 160912095304
 
Sequential circuits
Sequential circuitsSequential circuits
Sequential circuits
 
Combinational circuits
Combinational circuitsCombinational circuits
Combinational circuits
 
Karnaugh mapping allaboutcircuits
Karnaugh mapping allaboutcircuitsKarnaugh mapping allaboutcircuits
Karnaugh mapping allaboutcircuits
 
Aac boolean formulae
Aac   boolean formulaeAac   boolean formulae
Aac boolean formulae
 
Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858
 
Io systems final
Io systems finalIo systems final
Io systems final
 
File system interfacefinal
File system interfacefinalFile system interfacefinal
File system interfacefinal
 
File systemimplementationfinal
File systemimplementationfinalFile systemimplementationfinal
File systemimplementationfinal
 
Mass storage structurefinal
Mass storage structurefinalMass storage structurefinal
Mass storage structurefinal
 
All aboutcircuits karnaugh maps
All aboutcircuits karnaugh mapsAll aboutcircuits karnaugh maps
All aboutcircuits karnaugh maps
 
Virtual memoryfinal
Virtual memoryfinalVirtual memoryfinal
Virtual memoryfinal
 
Mainmemoryfinal 161019122029
Mainmemoryfinal 161019122029Mainmemoryfinal 161019122029
Mainmemoryfinal 161019122029
 

Recently uploaded

UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substationstephanwindworld
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptMadan Karki
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 

Recently uploaded (20)

UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
Earthing details of Electrical Substation
Earthing details of Electrical SubstationEarthing details of Electrical Substation
Earthing details of Electrical Substation
 
Indian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.pptIndian Dairy Industry Present Status and.ppt
Indian Dairy Industry Present Status and.ppt
 
8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 

ER Modelling Concepts

  • 1. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 1 Lecture 12: Entity Relationship Modelling  The Entity-Relationship Model  Entities  Relationships  Attributes  Constraining the instances  Cardinalities  Identifiers  Generalization
  • 2. University of Toronto Department of Computer Science © 2004-5 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.
  • 3. University of Toronto Department of Computer Science © 2004-5 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
  • 4. University of Toronto Department of Computer Science © 2004-5 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
  • 5. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 5 MeetsCourse Room Course instancesCourse instances Room instancesRoom instances Meets instancesMeets 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
  • 6. University of Toronto Department of Computer Science © 2004-5 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
  • 7. University of Toronto Department of Computer Science © 2004-5 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
  • 8. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 8 ““Each OrderEach Order either contains aeither contains a part or requestspart or requests a service, but nota service, but not bothboth”” ““For any given order,For any given order, whenever there is atwhenever there is at least one invoiceleast one invoice there is also at leastthere is also at least one shipmentone shipment and vice versaand vice versa”” AND/XOR Relationships
  • 9. University of Toronto Department of Computer Science © 2004-5 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
  • 10. University of Toronto Department of Computer Science © 2004-5 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
  • 11. University of Toronto Department of Computer Science © 2004-5 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
  • 12. University of Toronto Department of Computer Science © 2004-5 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
  • 13. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 13 MeetsCourse Room (2,2) Day (0,40) (0,N) ““A courseA course meets twicemeets twice a weeka week”” ““A room canA room can have up tohave up to 40 meetings40 meetings per weekper week”” ““A day canA day can have anhave an unlimitedunlimited number ofnumber of meetingsmeetings”” Cardinality Example Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999
  • 14. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 14 MeetsCourse 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
  • 15. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 15 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
  • 16. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 16 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-attributeexternal, multi-attribute Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999
  • 17. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 17 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
  • 18. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 18 Schema with Identifiers Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999
  • 19. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 19 Understanding Identifier Choices
  • 20. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 20 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
  • 21. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 21 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
  • 22. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 22 The E-R Meta-Model (as an E-R Diagram) Adapted from chapter 5 of Atzeni et al, “Database Systems” McGraw Hill, 1999
  • 23. University of Toronto Department of Computer Science © 2004-5 Steve Easterbrook. This presentation is available free for non-commercial use with attribution under a creative commons license. 23 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