0% found this document useful (0 votes)
13 views

CST1300 Workshop - Week 15

Uploaded by

alexsyr93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

CST1300 Workshop - Week 15

Uploaded by

alexsyr93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 36

CST1300 – Foundations of Informatics

Week 15 – Workshop
Entity Relationship Diagrams (ERD)
Relationships

Georgios A. Dafoulas
Computer Science Department
Faculty of Science and Technology
Middlesex University
Agenda

• Data models and relationships


• Relationship types and notations
• ERD examples
Data models and relationships
ER Diagram Data Models

• ERD usually has the following presentations:


– the conceptual data model
– the logical data model
– the physical data model

• Although these three forms all contain entities, relationships and


attributes, they are used by different groups of users.

• Normally, business analysts prefer to use the conceptual and logical


models, while database engineers like using the logical and physical
models.

Source:
https://www.edrawsoft.com/what-is-entity-relationship-diagram-erd.html?gclid=EAIaIQobChMI78ag1ry47gIVgRDmCh0MLQToEAMYASAAEgIDj
ER Diagram Data Models

• Conceptual Data Model


– This ERD model lacks specific details, and it only contains the definition and general tables
of the entities in a data system. The conceptual data model provides an overview of your
project scope and the general architecture of the system, and show how data sets are
related to each other. However, for smaller systems, it may not be necessary to draw such a
model.

• Logical Data Model


– This ERD model is more detailed than the conceptual data model because the former
type contains detailed attributes of entities and relationships between different sets. The
logical ER model is also developed independently of a specific database management
system.

• Physical Data Model


– The physical data model assigns more detailed technical details to each entity and it offers
users with guidance on how to construct their systems and associated data. Physical data
models are usually based on logical 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

• A logical model is a more detailed version of a conceptual data model.


• Attributes are added to each entity, and further entities can be added
that represent areas to capture data in the system.
• Here’s an example of the student and course data model created as a
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

• Design and troubleshooting of software and computer databases


– ERDs can be used to model data architecture for information systems at the early
stages of software planning.

• Scientific researches
– ER diagrams can also be used to study a large number of complex scientific data sets
or structured data sets.

• Business Information System


– ERD can also be used to design or analyse data in business processes, such as sales
figures, to simplify processes and improve efficiency. In addition, developers,
designers and customer service teams can use ER diagrams for effective team
communication.

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

• A relationship where two entities are participating is called a binary


relationship.

• Cardinality is the number of instance of an entity from a relation that can


be associated with the relation.

Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
One-to-one Relationship

• When only one instance of an entity is associated with the relationship, it


is marked as '1:1’.
• The following image reflects that only one instance of each entity should
be associated with the relationship.
• It depicts one-to-one relationship.

Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
One-to-many Relationship

• When more than one instance of an entity is associated with a


relationship, it is marked as '1:N’.
• The following image reflects that only one instance of entity on the left
and more than one instance of an entity on the right can be associated
with the relationship.
• It depicts one-to-many relationship.

Source:
https://www.tutorialspoint.com/dbms/er_diagram_representation.htm
Many-to-one Relationship

• When more than one instance of entity is associated with the


relationship, it is marked as 'N:1’.
• The following image reflects that more than one instance of an entity on
the left and only one instance of an entity on the right can be associated
with the relationship.
• It depicts 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

• One to One Relationship (1:1)


– Each student fills one seat and one seat is assigned to only one student.
– Each professor has one office space.

• One to Many Relationship (1:M)


– One instructor can teach many courses, but one course can only be taught by one
instructor.
– One instructor may teach many students in one class, but all the students have one
instructor for that class.

• Many to Many Relationship (M:M)


– Each student can take many classes, and each class can be taken by many students.
– Each consumer can buy many products, and each product can be bought by many
consumers.

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

• Convert many-to-many Relationships into one-to-many Relationships


– Entities in a many-to-many relationship must be linked in a special way, that is through
a third entity, called a composite entity also known as an associative entity.
A composite entity has only one function: to provide an indirect link between two
entities in a M:N relationship.
• The following graphic illustrates a composite entity that now indirectly
links the STUDENT and CLASS entities

Source:
https://www.relationaldbdesign.com/database-design/module6/convert-manyToManyRelationships-into-oneToManyRelationships.php
Handling many to many relationships

• Create a composite entity called STUDENT CLASSES from a


STUDENT entity and CLASS entity
• The M:N relationship between STUDENT and CLASS has been
dissolved into two one-to-many relations:
– The 1:N relationship between STUDENT and STUDENT CLASSES reads this way: for
one instance of STUDENT, there exists zero, one, or many instances of STUDENT
CLASSES; but for one instance of STUDENT CLASSES, there exists zero or one
instance of STUDENT.
– The 1:N relationship between CLASS and STUDENT CLASSES reads this way: For
one instance of CLASS, there exists zero, one, or many instances of STUDENT
CLASSES; but for one instance of STUDENT CLASSES, there exists zero or one
instance of CLASS.

Source:
https://www.relationaldbdesign.com/database-design/module6/convert-manyToManyRelationships-into-oneToManyRelationships.php
Handling many to many relationships

• In the language of tables, a composite entity is termed a linking table.

• 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.

• In the language of tables, a composite key attribute is termed


a composite primary key.

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

• ER diagrams vs. EER diagrams/ What's the difference? (https://cacoo.com/blog/er-diagrams-vs-eer-


diagrams-whats-the-difference/)
• A Guide to the Entity Relationship Diagram (ERD) - Database Star
(https://www.databasestar.com/entity-relationship-diagram/)
• Data Modeling and Entity Relationship Diagram (ERD)
(https://www.cs.uregina.ca/Links/class-info/215/erd/)
• Entity Relationship Diagram - ER Diagram in DBMS (https://beginnersbook.com/2015/04/e-r-model-in-
dbms/)
• ER Diagram Representation (https://www.tutorialspoint.com/dbms/er_diagram_representation.htm)
• What is an Entity Relationship Diagram (ERD)? - All You Need to Know
(https://www.edrawsoft.com/what-is-entity-relationship-diagram-erd.html?
gclid=EAIaIQobChMI78ag1ry47gIVgRDmCh0MLQToEAMYASAAEgIDjPD_BwE)
• Order System ER diagram (https://www.edrawsoft.com/templates/pdf/order-system-er-diagram.pdf)
• Convert many-to-many to one-to-many (ERD)
(https://www.relationaldbdesign.com/database-design/module6/convert-manyToManyRelationships-
into-oneToManyRelationships.php)
Questions

?
[email protected]

You might also like