SlideShare a Scribd company logo
1 of 36
Download to read offline
Design Model
Entity-Relationship Diagrams
Database
Development
Process
Common Data Models
• We have standard techniques for translating
between data models.
UML/OO ER Relational
class entity type relation/table
object entity tuple/row
attribute attribute attribute/column
association relationship foreign key
key attribute primary key
inheritance inheritance foreign key
Common Data Models
• UML and ER have graphical notations
• very good for conceptual design
• very expressive: capture more application semantics
• Relational model is an implementation model
• not good for conceptual design
• not very expressive: many concepts map to same notation
Entity Types
• Entity types àboxes
Weak entity type à double box
EMPLOYEE
Entity
DEPENDENT
Weak Entity
Entity Types
• Entity types are similar to classes,
they describe potential objects (entities)
that will appear in the database.
• Weak entity types describe dependent entities,
entities that depend on other entities for identity.
EMPLOYEE
Entity
DEPENDENT
Weak Entity
Attributes and Keys
• Attributes àovals
• Key attributes à underlined name
• Partial key attributes àdotted underlined name
Age
Attribute Key Attribute
SSN
Partial Key
Attribute
Date
Attributes and Keys
• Key attributes must be unique for each entity
• Keys are used to identify particular entities
• Partial keys are only partially unique
• used for weak entity types
Age
Attribute Key Attribute
SSN
Partial Key
Attribute
Date
Entity Types and Attributes
• Attributes are connected to entity types by lines
EMPLOYEE Phone
EID
Name
DEPENDENT
Age
Name
Entity Types and Entities
• Entities are instances of an entity type.
Entity Types and Keys
• All regular entity types must
have a key attribute or set of key attributes
• Weak entity types must have partial keys
• Weak entities get part of their key
(and part of their identity)
from some related entity.
Sets and Derived Attributes
• Multivalued attributes à double lined oval
• multivalued = set valued
• that there may be more than one value for the attribute.
• Derived attributes à dashed line ovals
• the attribute is computed from other data
Locations
Multivalued
Attribute
NumEmployees
Derived
Attribute
Composite Attributes
• Composite attributes à tree
• composed of other attributes.
• used for a set of related attributes,
when the set is not a conceptual entity
• the composite doesn’t have identity … it doesn’t have a key
Composite
Attribute
ZipCode
State
Address
Street
City
Relationships
• Relationships à diamonds
• Identifying relationship à double diamond
WorksOn
Relationship Identifying
Relationship
DependentOf
Relationships
• Relationships indicate a meaningful connection
between two entity types
• Relationships may have attributes,
but they cannot have key attributes.
• Identifying relationships connect a weak entity type
to some other entity type
• indicates where the weak entity gets a key
to complete its own partial key
WorksOn
Relationship Identifying
Relationship
DependentOf
Example Schema
EMPLOYEE
Phone
EID
Name
DEPENDENT Age
Name
WorksOn
DependentOf
PROJECT
Budget
Name
StartDate
Participation and Cardinality
• Participation and cardinality
define constraints on relationships
• Participation indicates whether an entity
is required to take part in a relationship
• Cardinality ratios and structural constraints
place limits on the number of entities
that may participate in a relationship
Participation Constraints
• Total participation à double or thick line
• indicates required participation
• Partial participation à thin line
• indicates optional participation
WorksFor
Total Participation
EMPLOYEE DEPARTMENT
WorksOn
Partial Participation
EMPLOYEE PROJECT
Participation Constraints
• Arrowheads can be used to indicate
an upper bound of 1 for participation
• (not used in our textbook)
R
X must participate in exactly one R
X Y
R
X may participate in at most one R
X Y
Cardinality Ratios
• Cardinality ratios specify
the maximum number of relationship instances
that an entity may participate in
Manages
1:1 ratio
EMPLOYEE DEPARTMENT
1 1
WorksFor
n:1 ratio
EMPLOYEE DEPARTMENT
n 1
WorksOn
n:m ratio
EMPLOYEE PROJECT
n m
Structural Constraints
• Structural constraints specify the minimum and
maximum number of relationship instances
that an entity may participate in
WorksFor
An employee must work for exactly 1 department.
A department must have at least 4 employees.
EMPLOYEE DEPARTMENT
(1,1) (4,n)
Manages
An employee may manage at most 1 department.
A department must have exactly 1 manager.
EMPLOYEE DEPARTMENT
(0,1) (1,1)
Participation and Cardinality
• There’s generally numerous ways to express a
relationship constraint.
(0,N) optional participation in any
number of relationships
optional participation in at
most one relationship
required participation in at
least one relationship
required participation in
exactly one relationship
(0,1)
(1,N)
(1,1)
Equivalent Notations
• An employee can manage at most one department.
• A department must have exactly one manager.
Manages
EMPLOYEE DEPARTMENT
(0,1) (1,1)
Manages
EMPLOYEE DEPARTMENT
1 1
Manages
EMPLOYEE DEPARTMENT
Equivalent Notations
• An employee must work for exactly one department.
• A department must have at least one employee.
WorksFor
EMPLOYEE DEPARTMENT
(1,1) (1,n)
n
WorksFor
EMPLOYEE DEPARTMENT
1
WorksFor
EMPLOYEE DEPARTMENT
Relationship Instances
WorksFor
EMPLOYEE DEPARTMENT
(1,1) (1,n)
Each EMPLOYEE instance
is connected to exactly
one WORKS_FOR
instance.
Each DEPARTMENT
instance is connected to
at least one WORKS_FOR
instance.
Relational Roles
• It is sometimes convenient
to name an entity’s role in a relationship.
• particularly useful in recursive relationships
• removes ambiguity in direction of relationship
(0,N) (0,1)
EMPLOYEE
Supervision
supervisor supervisee
Recursive Relationship
(0,N) (0,1)
EMPLOYEE
Supervision
supervisor supervisee
1 = supervisor
2 = supervisee
Notation Summary
Equivalent Schema defined in UML
Design an ER schema for the following enterprise:
lecture2.pdf

More Related Content

Similar to lecture2.pdf

Database Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptxDatabase Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptxyamuna67903
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)tameemyousaf
 
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptxDATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptxJasmineMichael1
 
Entity-Relationship Data Model
Entity-Relationship Data ModelEntity-Relationship Data Model
Entity-Relationship Data ModelBishrul Haq
 
Cn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingCn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingg30162363
 
39f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc239f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc2Mukund Trivedi
 
39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)Mukund Trivedi
 
Jobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptxJobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptxprosofts1
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).pptIshuIswarya3
 

Similar to lecture2.pdf (20)

Database Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptxDatabase Design and Entity relationship Model.pptx
Database Design and Entity relationship Model.pptx
 
Lecture7.pptx
Lecture7.pptxLecture7.pptx
Lecture7.pptx
 
Day 1 SQL.pptx
Day 1 SQL.pptxDay 1 SQL.pptx
Day 1 SQL.pptx
 
SQL.pptx
SQL.pptxSQL.pptx
SQL.pptx
 
RDBMS ERD
RDBMS ERDRDBMS ERD
RDBMS ERD
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Entity relationship diagram (erd)
Entity relationship diagram (erd)Entity relationship diagram (erd)
Entity relationship diagram (erd)
 
Database part3-
Database part3-Database part3-
Database part3-
 
DBMS Class 3
DBMS Class 3DBMS Class 3
DBMS Class 3
 
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptxDATA MODEL PRESENTATION UNIT I-BCA I.pptx
DATA MODEL PRESENTATION UNIT I-BCA I.pptx
 
Erd
ErdErd
Erd
 
Entity-Relationship Data Model
Entity-Relationship Data ModelEntity-Relationship Data Model
Entity-Relationship Data Model
 
Cn presentation on the topic called as re modelling
Cn presentation on the topic called as re modellingCn presentation on the topic called as re modelling
Cn presentation on the topic called as re modelling
 
Database design
Database designDatabase design
Database design
 
39f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc239f1b9a797dbms chapter2 b.sc2
39f1b9a797dbms chapter2 b.sc2
 
39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)39f1b9a797dbms chapter2 b.sc2 (1)
39f1b9a797dbms chapter2 b.sc2 (1)
 
Jobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptxJobs manager vs supervisor.pptx
Jobs manager vs supervisor.pptx
 
18306_lec-2 (1).ppt
18306_lec-2 (1).ppt18306_lec-2 (1).ppt
18306_lec-2 (1).ppt
 
er-models.pptx
er-models.pptxer-models.pptx
er-models.pptx
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
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
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
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
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
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
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 

lecture2.pdf

  • 3. Common Data Models • We have standard techniques for translating between data models. UML/OO ER Relational class entity type relation/table object entity tuple/row attribute attribute attribute/column association relationship foreign key key attribute primary key inheritance inheritance foreign key
  • 4. Common Data Models • UML and ER have graphical notations • very good for conceptual design • very expressive: capture more application semantics • Relational model is an implementation model • not good for conceptual design • not very expressive: many concepts map to same notation
  • 5. Entity Types • Entity types àboxes Weak entity type à double box EMPLOYEE Entity DEPENDENT Weak Entity
  • 6. Entity Types • Entity types are similar to classes, they describe potential objects (entities) that will appear in the database. • Weak entity types describe dependent entities, entities that depend on other entities for identity. EMPLOYEE Entity DEPENDENT Weak Entity
  • 7. Attributes and Keys • Attributes àovals • Key attributes à underlined name • Partial key attributes àdotted underlined name Age Attribute Key Attribute SSN Partial Key Attribute Date
  • 8. Attributes and Keys • Key attributes must be unique for each entity • Keys are used to identify particular entities • Partial keys are only partially unique • used for weak entity types Age Attribute Key Attribute SSN Partial Key Attribute Date
  • 9. Entity Types and Attributes • Attributes are connected to entity types by lines EMPLOYEE Phone EID Name DEPENDENT Age Name
  • 10. Entity Types and Entities • Entities are instances of an entity type.
  • 11. Entity Types and Keys • All regular entity types must have a key attribute or set of key attributes • Weak entity types must have partial keys • Weak entities get part of their key (and part of their identity) from some related entity.
  • 12. Sets and Derived Attributes • Multivalued attributes à double lined oval • multivalued = set valued • that there may be more than one value for the attribute. • Derived attributes à dashed line ovals • the attribute is computed from other data Locations Multivalued Attribute NumEmployees Derived Attribute
  • 13. Composite Attributes • Composite attributes à tree • composed of other attributes. • used for a set of related attributes, when the set is not a conceptual entity • the composite doesn’t have identity … it doesn’t have a key Composite Attribute ZipCode State Address Street City
  • 14.
  • 15. Relationships • Relationships à diamonds • Identifying relationship à double diamond WorksOn Relationship Identifying Relationship DependentOf
  • 16. Relationships • Relationships indicate a meaningful connection between two entity types • Relationships may have attributes, but they cannot have key attributes. • Identifying relationships connect a weak entity type to some other entity type • indicates where the weak entity gets a key to complete its own partial key WorksOn Relationship Identifying Relationship DependentOf
  • 18. Participation and Cardinality • Participation and cardinality define constraints on relationships • Participation indicates whether an entity is required to take part in a relationship • Cardinality ratios and structural constraints place limits on the number of entities that may participate in a relationship
  • 19. Participation Constraints • Total participation à double or thick line • indicates required participation • Partial participation à thin line • indicates optional participation WorksFor Total Participation EMPLOYEE DEPARTMENT WorksOn Partial Participation EMPLOYEE PROJECT
  • 20. Participation Constraints • Arrowheads can be used to indicate an upper bound of 1 for participation • (not used in our textbook) R X must participate in exactly one R X Y R X may participate in at most one R X Y
  • 21. Cardinality Ratios • Cardinality ratios specify the maximum number of relationship instances that an entity may participate in Manages 1:1 ratio EMPLOYEE DEPARTMENT 1 1 WorksFor n:1 ratio EMPLOYEE DEPARTMENT n 1 WorksOn n:m ratio EMPLOYEE PROJECT n m
  • 22. Structural Constraints • Structural constraints specify the minimum and maximum number of relationship instances that an entity may participate in WorksFor An employee must work for exactly 1 department. A department must have at least 4 employees. EMPLOYEE DEPARTMENT (1,1) (4,n) Manages An employee may manage at most 1 department. A department must have exactly 1 manager. EMPLOYEE DEPARTMENT (0,1) (1,1)
  • 23. Participation and Cardinality • There’s generally numerous ways to express a relationship constraint. (0,N) optional participation in any number of relationships optional participation in at most one relationship required participation in at least one relationship required participation in exactly one relationship (0,1) (1,N) (1,1)
  • 24. Equivalent Notations • An employee can manage at most one department. • A department must have exactly one manager. Manages EMPLOYEE DEPARTMENT (0,1) (1,1) Manages EMPLOYEE DEPARTMENT 1 1 Manages EMPLOYEE DEPARTMENT
  • 25. Equivalent Notations • An employee must work for exactly one department. • A department must have at least one employee. WorksFor EMPLOYEE DEPARTMENT (1,1) (1,n) n WorksFor EMPLOYEE DEPARTMENT 1 WorksFor EMPLOYEE DEPARTMENT
  • 26. Relationship Instances WorksFor EMPLOYEE DEPARTMENT (1,1) (1,n) Each EMPLOYEE instance is connected to exactly one WORKS_FOR instance. Each DEPARTMENT instance is connected to at least one WORKS_FOR instance.
  • 27. Relational Roles • It is sometimes convenient to name an entity’s role in a relationship. • particularly useful in recursive relationships • removes ambiguity in direction of relationship (0,N) (0,1) EMPLOYEE Supervision supervisor supervisee
  • 28. Recursive Relationship (0,N) (0,1) EMPLOYEE Supervision supervisor supervisee 1 = supervisor 2 = supervisee
  • 30.
  • 31.
  • 33.
  • 34.
  • 35. Design an ER schema for the following enterprise: