ENTITY RELATIONSHIP DIAGRAM
Higher Computing Science
ENTITY RELATIONSHIP DIAGRAM
• An ERD is a graphical representation of the entities in a database, and
their relationship to each other
• Indicates:
• Entity name
• Relationship
• Cardinality
• Attribute names (optional)
CARDINALITY
Cardinality is a description of the numerical relationship between the rows
of one table and the rows of the other.
There are 3 types of cardinality:
• One-to-one (1:1)
• One-to-many (1:m)
• Many-to-many (m:n)
CARDINALITY
Employee Laptop
Company
Project
works on
is allocated
works for
Employee
Employee
One-to-one
relationship
One-to-many
relationship
Many-to-
many
relationship
ERD – EMPLOYEE EXAMPLE
Employee Company
works for
Employee
Code
Name
Salary
DOB
Company
Number *
Company
Name
Company
Number
Address
Telephone
Managing
Director
ERD – CAR HIRE EXAMPLE
Customer Booking Car Depot
places contain
s
is stored at

Entity Relationship Diagrams

  • 1.
  • 2.
    ENTITY RELATIONSHIP DIAGRAM •An ERD is a graphical representation of the entities in a database, and their relationship to each other • Indicates: • Entity name • Relationship • Cardinality • Attribute names (optional)
  • 3.
    CARDINALITY Cardinality is adescription of the numerical relationship between the rows of one table and the rows of the other. There are 3 types of cardinality: • One-to-one (1:1) • One-to-many (1:m) • Many-to-many (m:n)
  • 4.
    CARDINALITY Employee Laptop Company Project works on isallocated works for Employee Employee One-to-one relationship One-to-many relationship Many-to- many relationship
  • 5.
    ERD – EMPLOYEEEXAMPLE Employee Company works for Employee Code Name Salary DOB Company Number * Company Name Company Number Address Telephone Managing Director
  • 6.
    ERD – CARHIRE EXAMPLE Customer Booking Car Depot places contain s is stored at