8.1 Database Concepts

Bulk view disabled for Guests. View lessons individually.

Relational Database Concepts

1. Flat-file vs. Relational Databases

Flat-File Database

All data is stored in a single table. This leads to Data Redundancy (repeating the same info) and Data Inconsistency (typos in repeated data).

Relational Database

Data is split into multiple, related tables. This ensures Data Integrity and allows for complex queries across different entities.

2. Key Terminology

Term A-Level Definition Alternative Name
Entity An object or concept about which data is stored (e.g., Student, Course). Table
Attribute A characteristic of an entity (e.g., StudentName). Field / Column
Tuple A single instance of an entity. Record / Row

3. The "Keys" to the Database

  • Primary Key (PK): A unique identifier for every record in a table (e.g., StudentID).
  • Foreign Key (FK): An attribute in one table that is a Primary Key in another. It creates the link between tables.
  • Composite Key: A primary key made of two or more attributes combined to ensure uniqueness.

4. Entity-Relationship (E-R) Models

E-R Diagrams show how tables are linked. At AS-Level, you must understand three types of relationships:

1. One-to-One (1:1) — e.g., Headteacher to School.
2. One-to-Many (1:M) — e.g., Teacher to Students.
3. Many-to-Many (M:N) — e.g., Students to Courses.
⚠️ Exam Note: Resolving M:N Relationships

A relational database cannot handle a direct Many-to-Many link. You must resolve it by creating a Link Table (Join Table) in the middle, turning the relationship into two One-to-Many links.

⚠️ AS-Level Focus: Referential Integrity

This is a rule that ensures consistency. You cannot have a Foreign Key value in the "Many" table that doesn't exist as a Primary Key in the "One" table. (e.g., You can't assign a student to a CourseID that doesn't exist).