Track progress, take quizzes and save notes on this lesson.

Free forever · no card needed

Start free
Intermediate

Entity-Relationship Modelling and Relational Databases

4.10.1 Conceptual data models and ER modelling·4.10.2 Relational databases

Aligned to the AQA 7517 specification

Level
Intermediate
Reading time
6 min
Published
13 June 2026
Updated
1 July 2026
On this page
  1. 1.Data Modelling from Requirements
  2. 2.Entity-Relationship Diagrams
  3. 3.Entity Notation
  4. 4.Relational Database Concepts
  5. 5.Primary Keys, Foreign Keys, and Relationships
  6. 6.Common Exam Mistakes

Key takeaways

  • To model from requirements, identify nouns as candidate entities, their properties as attributes, and verbs connecting entities as relationships, then determine each relationship's cardinality (1:1, 1:N, or M:N).
  • Many-to-many relationships cannot be directly implemented in a relational database and must be resolved into two one-to-many relationships via a junction (linking) table.
  • A foreign key is an attribute that references the primary key of another table and is how relational databases implement relationships between tables.
  • Referential integrity requires a foreign key value to either match an existing primary key in the referenced table or be NULL.
  • In AQA entity notation, the primary key is underlined and a foreign key is marked with a `*` suffix; omitting foreign key notation loses marks.

Data Modelling from Requirements

Given a description of a real-world problem, you must identify the entities, their attributes, and the relationships between them.

Process:

  1. Identify nouns in the requirements as candidate entities (things the system needs to store data about)
  2. Identify properties of each entity as attributes
  3. Identify verbs/actions connecting entities as relationships
  4. Determine the cardinality of each relationship (1:1, 1:many, many:many)

Example requirements: "A library stores books. Each book can be borrowed by multiple members. Each member can borrow multiple books at different times. A book has a title, ISBN, and author. A member has a member ID, name, and email."

Entities: Book, Member, Loan (the act of borrowing)

Entity-Relationship Diagrams

An ER diagram visually represents entities, their attributes, and their relationships.

Notation:

  • Rectangles represent entities
  • Ovals (or listed columns) represent attributes; underlined = key attribute
  • Lines between entities represent relationships; labels describe the relationship
  • Crow's foot or numbers indicate cardinality

Relationship cardinalities:

TypeNotationMeaningExample
One-to-one (1:1)1 ── 1Each entity instance relates to exactly one of the otherPerson ─── Passport
One-to-many (1:N)1 ──< NOne instance relates to many of the otherCustomer ─── Orders
Many-to-many (M:N)M >──< NMany instances relate to many of the otherStudent ─── Courses

Many-to-many relationships cannot be directly implemented in a relational database. They must be resolved into two one-to-many relationships via a junction (linking) table. The library example below resolves the many-to-many between Member and Book using a Loan junction entity:

Entity Notation

The AQA specification uses a text notation for relational schema:

Entity(<u>PrimaryKey</u>, Attribute1, Attribute2, ForeignKey*)
  • <u>PrimaryKey</u> — the primary key is underlined
  • * suffix on an attribute indicates it is a foreign key
  • Attributes are separated by commas

Library example:

Book(<u>ISBN</u>, Title, AuthorID*)
Author(<u>AuthorID</u>, FirstName, LastName)
Member(<u>MemberID</u>, Name, Email)
Loan(<u>LoanID</u>, ISBN*, MemberID*, LoanDate, ReturnDate)

Loan is the junction table that resolves the many-to-many relationship between Book and Member.

Relational Database Concepts

A relational database organises data into tables (relations). Each table stores data about one entity.

TermDefinitionExample
Table (relation)A collection of rows about one entity typeMember table
AttributeA column; a property of the entityEmail, Name
Row (tuple/record)One instance of the entityA specific member
Primary keyAn attribute (or set of attributes) that uniquely identifies each rowMemberID
Composite primary keyTwo or more attributes together form the primary key(ISBN, MemberID) in a Loan table
Foreign keyAn attribute that references the primary key of another tableMemberID in Loan references MemberID in Member

Referential integrity: a foreign key value must either match an existing primary key in the referenced table, or be NULL. A database cannot have a Loan record pointing to a MemberID that does not exist in the Member table.

How much of this have you taken in?

Quiz yourself on this section, free, no card needed.

Test myself

Primary Keys, Foreign Keys, and Relationships

Foreign keys are how relational databases implement relationships between tables.

One-to-many (Customer → Orders):

Customer(<u>CustomerID</u>, Name, Email)
Order(<u>OrderID</u>, CustomerID*, Date, Total)

Each Order row has a CustomerID foreign key referencing the Customer table. One customer may appear in many Order rows — one-to-many.

Many-to-many resolved (Student ↔ Course):

Student(<u>StudentID</u>, Name)
Course(<u>CourseCode</u>, Title)
Enrolment(<u>StudentID*</u>, <u>CourseCode*</u>, EnrolmentDate)

Enrolment is a junction table with a composite primary key of (StudentID, CourseCode). Each student-course pair is unique. One student may appear in many rows; one course may appear in many rows — many-to-many resolved via two one-to-many relationships.

Common Exam Mistakes

1. Placing attributes in the wrong entity

Attributes belong to the entity they directly describe. A customer's email belongs in Customer, not Order. A product's price belongs in Product, not OrderLine (unless you need to record the price at time of sale — then it belongs in both).

2. Forgetting to resolve many-to-many relationships

Relational databases cannot directly represent many-to-many. If your ER diagram has a many-to-many between A and B, you need a junction table C with foreign keys to both A and B.

3. Confusing primary key and unique key

A primary key uniquely identifies rows and cannot be NULL. A table can have only one primary key. Other attributes may be unique (e.g. email must be unique) but are not the primary key unless designated.

4. Omitting foreign keys from the entity notation

When writing entity notation, every foreign key must be marked (with * or underlined as FK). Omitting the foreign key notation loses marks, as it is how the relationship between tables is declared.

Key terms

Entity
A thing the system needs to store data about; identified from nouns in the requirements and shown as a rectangle in an ER diagram.
Attribute
A property of an entity; a column in a table, such as Email or Name.
Relationship
A connection between entities, identified from verbs in the requirements and shown as a labelled line in an ER diagram.
Cardinality
The type of a relationship: one-to-one (1:1), one-to-many (1:N), or many-to-many (M:N).
ER diagram
A diagram that visually represents entities, their attributes, and the relationships between them.
Junction (linking) table
A table that resolves a many-to-many relationship into two one-to-many relationships by holding foreign keys to both entities.
Relational database
A database that organises data into tables (relations), each storing data about one entity.
Primary key
An attribute or set of attributes that uniquely identifies each row in a table and cannot be NULL.
Composite primary key
A primary key formed from two or more attributes together, such as (StudentID, CourseCode) in a junction table.
Foreign key
An attribute that references the primary key of another table, implementing a relationship between tables; marked with a `*` suffix in AQA notation.
Referential integrity
The rule that a foreign key value must either match an existing primary key in the referenced table or be NULL.

Frequently asked questions

A many-to-many relationship cannot be directly represented in a relational database, so it must be resolved into two one-to-many relationships using a junction (linking) table that holds foreign keys to both entities. For example, a Loan junction table resolves the many-to-many between Member and Book.

A foreign key is an attribute that references the primary key of another table, and it is how relational databases implement relationships between tables. Referential integrity requires a foreign key value to either match an existing primary key in the referenced table or be NULL, so a Loan cannot point to a MemberID that does not exist.

A primary key uniquely identifies rows, cannot be NULL, and a table can have only one. Other attributes may also be unique, such as an email, but are not the primary key unless specifically designated as such.

Generate revision on any topic you study

Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.

Lessons on anything

Structured, level-matched lessons on any topic you study

Practice quizzes

Find out what you actually know before the exam does

Flashcard sets

Lock in key concepts with instant revision cards

Ask Aica

Stuck on something? Get a clear explanation, any time

Prev

Web Technologies and Client Models

Next

Database Normalisation

Related lessons

5 min

Top students don’t revise more. They revise what counts.

Start revising free

Free to start. No card needed.