CST1300 Workshop - Week 15
CST1300 Workshop - Week 15
Week 15 – Workshop
Entity Relationship Diagrams (ERD)
Relationships
Georgios A. Dafoulas
Computer Science Department
Faculty of Science and Technology
Middlesex University
Agenda
Source:
https://www.edrawsoft.com/what-is-entity-relationship-diagram-erd.html?gclid=EAIaIQobChMI78ag1ry47gIVgRDmCh0MLQToEAMYASAAEgIDj
ER Diagram Data Models
Source:
https://www.edrawsoft.com/what-is-entity-relationship-diagram-erd.html?gclid=EAIaIQobChMI78ag1ry47gIVgRDmCh0MLQToEAMYASAAEgIDj
Conceptual Data Model
• The conceptual data model shows the business objects that exist in the
system and how they relate to each other.
• It defines the entities that exist, which are not necessarily tables.
Thinking of tables is too detailed for this type of data model.
• An example of a conceptual data model is shown here. It shows
students, courses, and how they relate.
Source:
https://www.databasestar.com/entity-relationship-diagram/
Logical Data Model
Source:
https://www.databasestar.com/entity-relationship-diagram/
Physical Data Model
• The physical data model is the most detailed data model in this process.
It defines a set of tables and columns and how they relate to each other.
It includes primary and foreign keys, as well as the data types for each
column.
• These diagrams can be created manually in a data modelling tool. They
are also often generated by an IDE from an existing database.
• Here’s an example of the student and course physical data model.
Source:
https://www.databasestar.com/entity-relationship-diagram/
The differences between a conceptual,
logical, and physical model
Source:
https://www.databasestar.com/entity-relationship-diagram/
ERD Application
• Scientific researches
– ER diagrams can also be used to study a large number of complex scientific data sets
or structured data sets.
Source:
https://www.edrawsoft.com/what-is-entity-relationship-diagram-erd.html?gclid=EAIaIQobChMI78ag1ry47gIVgRDmCh0MLQToEAMYASAAEgIDj
Components of an ER diagram
Source:
https://beginnersbook.com/2015/04/e-r-model-in-dbms/
ERD Example
• Relationships keep
everything together
Source:
https://www.edrawsoft.com/templates/pdf/order-system-er-diagram.pdf
ERD: Relationship Type and Degree
►
Play video
Source:
https://www.youtube.com/watch?v=uZRXWFGd4pM
Relationship types and notations
Binary Relationship and Cardinality
Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
One-to-one Relationship
Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
One-to-many Relationship
Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
Many-to-one Relationship
Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
Many-to-many Relationship
• The following image reflects that more than one instance of an entity on
the left and more than one instance of an entity on the right can be
associated with the relationship.
• It depicts many-to-many relationship.
Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
Relationship examples
Source:
https://www.cs.uregina.ca/Links/class-info/215/erd/
Participation Constraints
• Total Participation
– Each entity is involved in the relationship.
– Total participation is represented by double lines.
• Partial participation
– Not all entities are involved in the relationship.
– Partial participation is represented by single lines.
Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
Handling many to many relationships
Source:
https://www.relationaldbdesign.com/database-design/module6/convert-manyToManyRelationships-into-oneToManyRelationships.php
Handling many to many relationships
Source:
https://www.relationaldbdesign.com/database-design/module6/convert-manyToManyRelationships-into-oneToManyRelationships.php
Handling many to many relationships
• A composite entity has no key attribute of its own; rather, it receives the
key attributes from each of the two entities it links, and combines them to
form a composite key attribute.
Source:
https://www.relationaldbdesign.com/database-design/module6/convert-manyToManyRelationships-into-oneToManyRelationships.php
Relationship notations
Chen
Source:
https://www.databasestar.com/entity-relationship-diagram/
Relationship notations
Crow’s Foot
Source:
https://www.databasestar.com/entity-relationship-diagram/
Relationship notations
Bachman
Source:
https://www.databasestar.com/entity-relationship-diagram/
Relationship notations
IDEF1X
Source:
https://www.databasestar.com/entity-relationship-diagram/
Relationship notations
Barker
Source:
https://www.databasestar.com/entity-relationship-diagram/
Entity Relationship Diagram (ERD)
Training Video
►
Play video
Source:
https://www.youtube.com/watch?v=-fQ-bRllhXc
ERD examples
ERD example
(emphasis on relationships)
Source:
https://www.cs.uregina.ca/Links/class-info/215/erd/
ERD example
(emphasis on relationships)
Source:
https://cacoo.com/blog/er-diagrams-vs-eer-diagrams-whats-the-difference/
ERD Entity Relationship Diagram
Cardinality Relationships
►
Play video
Source:
https://www.youtube.com/watch?v=u2QqjofJvGo
Resources