Photo AI

Last Updated Sep 27, 2025

Entity Relationship Diagrams Simplified Revision Notes

Revision notes with simplified explanations to understand Entity Relationship Diagrams quickly and effectively.

user avatar
user avatar
user avatar
user avatar
user avatar

443+ students studying

Entity Relationship Diagrams

Overview

An Entity Relationship Diagram (ERD) is a visual tool used to model the structure of a relational database. ERDs illustrate how entities (tables) are connected, using different types of relationships to represent how data relates within a system. ERDs also help with database design by clearly defining primary keys, foreign keys, and secondary keys in each table, making it easier to manage data and establish meaningful connections between tables.

This note covers key terminology, relationship types, and how to construct ERDs, as well as how to identify linkages between tables in a database.

Keys in Databases

Primary Key:

  • A unique identifier for each record in a table.
  • Ensures that no two records in the table are identical.
  • Typically a single field (e.g., Student_ID) but can sometimes be a composite key (a combination of fields).
  • Example: In a Students table, Student_ID could serve as the primary key.

Foreign Key:

  • A field in one table that creates a link to the primary key of another table, establishes a relationship between tables.
  • Allows data from one table to relate to data in another, enabling complex data structures.
  • Example: In an Enrollments table, Student_ID could be a foreign key linking to the Student_ID in the Students table.

Secondary Key:

  • A field used for data retrieval purposes to allow quick access to records based on commonly searched attributes.
  • Unlike primary keys, secondary keys are not necessarily unique.
  • Example: In a Books table, Author could be a secondary key if the system frequently searches for books by author.

Types of Relationships in ERDs

One-to-One (1:1****):

  • Each record in one table is linked to only one record in another table, and vice versa.
  • Common in cases where data is split for security or organisational reasons.
  • Example: A Person table with personal details and a Passport table where each person has only one passport.

One-to-Many (1
****):

  • A single record in one table can be linked to multiple records in another table.
  • The most common relationship type in relational databases.
  • Example: A Teacher can teach multiple Classes, but each Class has only one Teacher.

Many-to-Many (M
****):

  • Multiple records in one table can link to multiple records in another table.
  • Implemented by creating a junction table (or associative table) with foreign keys linking back to both tables.
  • Example: Students and Courses tables have an M
    relationship, as students can enrol in multiple courses, and courses can have multiple students. An Enrollments table would serve as the junction table.

Constructing an ERD

Identify Entities:

  • Entities represent tables in the database (e.g., Student, Course, Teacher).
  • Each entity should have a primary key to uniquely identify records.

Define Relationships:

  • Determine how entities relate to each other (1:1, 1
    , or M
    ).
  • Use foreign keys to establish links between tables for 1:1 and 1
    relationships.
  • For M
    relationships, create a junction table with foreign keys pointing back to each entity.

Draw the ERD:

  • Use rectangles to represent entities.
  • Use lines to connect related entities, labelling each line with the relationship type (1:1, 1
    , M
    ).
  • Indicate primary and foreign keys within each entity.

Example ERD

infoNote

Consider a simple school database with three entities: Students, Courses, and Enrollments.

Entities and Relationships:

  • Students: Each student has a unique Student_ID (primary key).
  • Courses: Each course has a unique Course_ID (primary key).
  • Enrollments: This junction table has a composite primary key composed of Student_ID and Course_ID, linking students to courses (M
    relationship).

ERD Structure:

  • Students (1) ——— (M) Enrollments (M) ——— (1) Courses

Diagram Key:

  • Students Table:
  • Primary Key: Student_ID
  • Other Fields: Name, Date_of_Birth
  • Courses Table:
  • Primary Key: Course_ID
  • Other Fields: Course_Name, Credits
  • Enrollments Table (junction table for M
    ):
  • Composite Primary Key: (Student_ID, Course_ID)
  • Foreign Keys: Student_ID references Students table, Course_ID references Courses table.

Examples of Relationships in ERDs

One-to-One (1:1) Example:

  • Person and Passport tables where each person has only one passport.
  • Relationship in ERD: A line connecting Person and Passport with a 1:1 label.

One-to-Many (1
)
Example:

  • Teacher and Classes tables where each teacher teaches multiple classes.
  • Relationship in ERD: A line connecting Teacher to Classes with a 1
    label.

Many-to-Many (M
)
Example:

  • Students and Courses tables where students enrol in multiple courses.
  • Implemented with an Enrollments table, where each enrollment links a student to a course through foreign keys.

Note Summary

infoNote

Common Mistakes

  • Confusing 1
    and M
    relationships: Ensure that M
    relationships are correctly handled with a junction table.
  • Not specifying primary and foreign keys clearly: Every table must have a primary key, and foreign keys should link related tables.
  • Incorrect or missing relationship labels: Label each relationship in the ERD to avoid confusion, specifying whether it is 1:1, 1
    , or M
    .
infoNote

Key Takeaways

  • Primary Key uniquely identifies records in a table; Foreign Key links tables by referencing the primary key of another table; Secondary Key is used for search efficiency.
  • ERDs use relationships (1:1, 1
    , M
    ) to visually represent data connections.
  • For M
    relationships, always use a junction table.
  • Well-designed ERDs help in creating a clear, efficient, and logical database structure for complex data storage and retrieval.
Books

Only available for registered users.

Sign up now to view the full note, or log in if you already have an account!

500K+ Students Use These Powerful Tools to Master Entity Relationship Diagrams

Enhance your understanding with flashcards, quizzes, and exams—designed to help you grasp key concepts, reinforce learning, and master any topic with confidence!

70 flashcards

Flashcards on Entity Relationship Diagrams

Revise key concepts with interactive flashcards.

Try Computer Science Flashcards

7 quizzes

Quizzes on Entity Relationship Diagrams

Test your knowledge with fun and engaging quizzes.

Try Computer Science Quizzes

29 questions

Exam questions on Entity Relationship Diagrams

Boost your confidence with real exam questions.

Try Computer Science Questions

27 exams created

Exam Builder on Entity Relationship Diagrams

Create custom exams across topics for better practice!

Try Computer Science exam builder

12 papers

Past Papers on Entity Relationship Diagrams

Practice past papers to reinforce exam experience.

Try Computer Science Past Papers

Other Revision Notes related to Entity Relationship Diagrams you should explore

Discover More Revision Notes Related to Entity Relationship Diagrams to Deepen Your Understanding and Improve Your Mastery

96%

114 rated

Databases

Relational Databases

user avatar
user avatar
user avatar
user avatar
user avatar

417+ studying

188KViews

96%

114 rated

Databases

Data Normalisation

user avatar
user avatar
user avatar
user avatar
user avatar

452+ studying

199KViews

96%

114 rated

Databases

Capturing, Selecting, Managing & Exchanging Data

user avatar
user avatar
user avatar
user avatar
user avatar

369+ studying

188KViews

96%

114 rated

Databases

SQL

user avatar
user avatar
user avatar
user avatar
user avatar

249+ studying

180KViews
Load more notes

Join 500,000+ A-Level students using SimpleStudy...

Join Thousands of A-Level Students Using SimpleStudy to Learn Smarter, Stay Organized, and Boost Their Grades with Confidence!

97% of Students

Report Improved Results

98% of Students

Recommend to friends

500,000+

Students Supported

50 Million+

Questions answered