Professional Documents
Culture Documents
Week 16 – Workshop
Entity Relationship Diagrams (ERD)
Cardinalities
Georgios A. Dafoulas
Computer Science Department
Faculty of Science and Technology
Middlesex University
Agenda
Source:
https://astera.zendesk.com/hc/en-us/articles/115000512603-Overview-of-Cardinality-in-Data-Modeling
Overview of Cardinality in Data
Modelling
Source:
https://astera.zendesk.com/hc/en-us/articles/115000512603-Overview-of-Cardinality-in-Data-Modeling
Types of Cardinality Ratios
Source:
https://www.gatevidyalay.com/cardinality-in-er-diagram/
Many-to-Many Cardinality
• An entity in set A can be associated with any number (zero or more) of entities
in set B.
• An entity in set B can be associated with any number (zero or more) of entities
in set A.
Symbol
Example
Symbol
Example
• An entity in set A can be associated with any number (zero or more) of entities
in set B.
• An entity in set B can be associated with at most one entity in set A.
Symbol
Example
Symbol
Example
►
Play video
Source:
https://www.youtube.com/watch?v=CdGu83hrxLY
From conceptual modelling to relational
schema
Transforming conceptual model to
relational schema
• The final objective is to keep such semantics in the database itself and
not in those applications that access to the database.
Source:
http://what-when-how.com/information-science-and-technology/relationship-cardinality-constraints-in-relational-database-design/
Cardinality constraint
Source:
http://what-when-how.com/information-science-and-technology/relationship-cardinality-constraints-in-relational-database-design/
Cardinality notations
Source:
https://stackoverflow.com/questions/4755497/single-line-with-an-arrow-mark-in-entity-relattionship-diagram
Table relationships
• One-to-One Relationships
– A key will appear only once in a related table.
– An example of a one-to-one relationship is if each employee is assigned one computer
within a company.
• One-to-many relationships
– Keys from one table will appear multiple times in a related table.
• Many-to-many relationships
– Often causes problems in practical examples of normalised databases.
– Need to break many-to-many relationships into a series of one-to-many relationships.
– The key value of one table can appear many times in a related table.
– The opposite is also true, meaning that the primary key from that second table can
also appear many times in the first table.
Source:
https://www.informit.com/articles/article.aspx?p=27281&seqNum=3
Table relationships
• One-to-One Relationships
• One-to-many relationships
• Many-to-many relationships
Source:
https://www.informit.com/articles/article.aspx?p=27281&seqNum=3
Databases: Minimum Cardinality
►
Play video
Source:
https://www.youtube.com/watch?v=s1SMih8XBLI
Converting ER model to relational model
Converting ER model to relational model
Source:
https://www.geeksforgeeks.org/mapping-from-er-model-to-relational-model/
Converting ER model to relational model
Source:
https://www.geeksforgeeks.org/mapping-from-er-model-to-relational-model/
Converting ER model to relational model
Source:
https://www.geeksforgeeks.org/mapping-from-er-model-to-relational-model/
Entity-Relationship Diagrams:
Minimum cardinalities: Order
processing example
►
Play video
Source:
https://www.youtube.com/watch?v=TwIbBoTUPHQ
Resources
?
g.dafoulas@mdx.ac.uk