01 flat files vs relational databases
Comparing flat-file limitations like data redundancy with the structured integrity of relational database systems.

Ever wondered how companies like Amazon or Spotify manage millions of users, products, and playlists without everything descending into chaos? They certainly do not use a single, giant spreadsheet. In this lesson, you will step into the shoes of a Database Administrator - a true 'Data Custodian' - to uncover why simple flat files are a ticking time bomb for data integrity, and how the relational model provides the robust, structured solution that powers almost every major application you use.
Learning Outcomes
Factual (Knowing that)
Conceptual (Knowing why)
Procedural (Knowing how)
Recall the definition of a flat-file database and a relational database.
Describe the concepts of data redundancy, data consistency, and data independence.
Conceptual (Knowing why)
Explain the limitations and dangers of using a flat-file structure for managing large or complex datasets.
Analyse the role and benefits of a Database Management System (DBMS) in maintaining data integrity.
Procedural (Knowing how)
Identify insertion, update, and deletion anomalies within a given flat-file database table.
Propose how a flat-file structure could be decomposed into multiple entities to reduce data redundancy.
From Flat Files to Relational Databases
The World on a Single Sheet: The Flat-File Database
At its simplest, a database is just an organised collection of data. The most basic way to store data is in a flat-file database. Imagine a single spreadsheet, a CSV file, or a simple text file where all the information is lumped together in one large table. For a personal address book or a short list of ten favourite songs, this works perfectly well. Each row represents a complete entry, and each column represents a particular attribute.
However, as soon as the data becomes more complex or grows in volume, this simple structure begins to reveal some serious and dangerous flaws. Storing all your data in one place might seem easy at first, but it creates a significant problem known as data redundancy.
Data Redundancy: The Ticking Time Bomb
Data redundancy is the unnecessary duplication of data within a database. Consider a simple database for a college, stored as a flat file.

So much redundancy...
In this example, every time a student enrols on a course, we repeat the Course ID, Course Name and we have to specify who is teaching it. If Dr. Turing teaches 30 students, his name and office number are needlessly duplicated 30 times. This isn't just inefficient in terms of storage; it's a "ticking time bomb" that threatens the data integrity of the entire system. Data integrity refers to the overall accuracy, completeness, and consistency of data. If we can't trust our data, any information or knowledge we derive from it is worthless. This leads to three specific types of error, known as data anomalies.
Update Anomalies
What happens if Dr. Turing moves rooms? With the flat-file structure, a database administrator would have to find and manually change every single record for every student Dr. Turing teaches. If they miss even one, the database is now in an inconsistent state. Some records say his room is '204', while others say '205'. Which is correct? The data can no longer be trusted. This failure to update all instances of a piece of data is called an update anomaly.
Insertion Anomalies
Imagine the college hires a new tutor, Dr. Lovelace. How do we add her to the database? We can't. In our current structure, a tutor's details are tied to a student's enrolment. Until a student is assigned to Dr. Lovelace, there is no record we can create to store her details. We cannot add a new tutor without also adding a student. This inability to add data because another piece of data is missing is an insertion anomaly.
Deletion Anomalies
Now, consider a student who is enrolled on a niche course and is the only student taught by a particular tutor. If that student decides to drop the course and we delete their enrolment record, what happens? We might accidentally delete the only copy of that tutor's details from the entire database. The unintentional loss of related data when a record is removed is known as a deletion anomaly.
The Relational Solution and the DBMS
To solve these problems, we use a relational database. The core principle is to "divide and conquer". Instead of one massive table, we decompose the data into multiple, smaller tables, where each table represents a single entity (like 'Students', 'Courses', 'Tutors' and 'Rooms').

No redundancy?
Now, a room is stored only once. If Room 204 changes name, we only need to make a single change in the
rooms table. In a later lesson, we'll discover how the links between the tables ensures this update is instantly reflected for all 30 of his students. This structure eliminates all three anomalies.This is managed by a Database Management System (DBMS) - specialised software like MySQL, Microsoft SQL Server, or Oracle. A DBMS is responsible for:
Managing Data Consistency: Ensuring the integrity and relationships between data are enforced.
Providing Data Independence: Separating the logical data structure from the physical application software. This means you can change the database structure without having to rewrite the application code from scratch.
Controlling Access: Handling security, user accounts, and ensuring multiple users can access the data concurrently without corrupting it.
By embracing the relational model, we move from a fragile, error-prone filing system to a robust, reliable, and scalable data architecture fit for modern applications.
Force a connection. Identify two concepts from these notes (e.g., 'Data Redundancy' and 'Data Independence') and explicitly link them to a topic we covered in a previous module, such as Object-Oriented Programming or Data Structures. Write a short paragraph explaining how understanding one strengthens your understanding of the other.

Task Spot the Flaws

1
Identify Data Redundancy
Look carefully at the table. In your booklet, list the column names for all the fields that contain repeated, redundant data.
2
Describe the Anomalies
Based on the data in the table, write a short, one-sentence description for a potential situation that would cause:
An update anomaly (e.g., "If customer Eva Green moves house...")
An insertion anomaly (e.g., "If the garage wants to add a new salesperson who hasn't sold a car yet...")
A deletion anomaly (e.g., "If the garage deletes the record for SaleID 2...")
3
Decompose the Problem
Think procedurally and break the single table down. In your booklet, design a relational structure by creating at least three new tables. For each table, give it a name (e.g., `Customers`) and list the fields (column names) that should belong in it. This process of breaking down a large problem into smaller parts is called decomposition, a core part of computational thinking.
Hungry for more?
Ask an AI: Click on the carefully written prompt below to learn more...
Role: You are an expert A-Level Computer Science tutor. Task: Explain the difference between a flat-file and a relational database, focusing on the problems of data redundancy and update anomalies. Use a simple, clear example of a school library system. Length: Maximum 200 words. Audience: A 17-year-old A-Level Computer Science student. Tone: Academic, clear, and concise. Constraints: Use bullet points to list the three main types of data anomaly. NO intro, NO outro, NO deviation from the topic, NO follow-up questions.
The Single Source of Truth: Explain in one sentence why having a 'single source of truth' for a piece of data (like a customer's address) is critical for a business.
Outcome: You will have identified the critical flaws in a flat-file database and designed a decomposed, relational structure to improve its integrity.

Sticky Note Challenge
On a post-it note, draw two simple boxes representing tables for 'Students' and 'TutorGroups'. Draw a line between them to show how they might be linked. What single piece of data would be the 'link'? Stick your post-it note in your booklet.Last modified: September 22nd, 2026
