Explain why file‑based systems are inadequate, describe the key features of a relational database that overcome those limitations, and demonstrate understanding of ER modelling, normalisation (1NF‑3NF), and basic SQL (DDL & DML).
File‑based applications store data in flat files that programmes read and write directly. The Cambridge syllabus highlights the following drawbacks.
| Limitation | Explanation |
|---|---|
| Data redundancy & inconsistency | The same fact (e.g. a student’s address) appears in several files; updating one copy may leave others unchanged. |
| Poor data integrity | No built‑in checks for uniqueness, referential integrity or domain rules. |
| Lack of data independence | Any change to file layout (add a field, change format) forces every programme that uses the file to be rewritten. |
| Limited query capability | Procedural code is required to locate, sort and combine data; ad‑hoc queries are difficult. |
| Concurrency problems | Simultaneous access can cause lost updates, overwriting or corrupted files. |
| Coarse‑grained security | Only OS‑level file permissions are available; fine‑grained user/role control is missing. |
| File | Typical fields |
|---|---|
| Students.txt | StudentID, Name, DOB, Address, Course1, Course2, … |
| Courses.txt | CourseID, Title, Credits, Lecturer, EnrolledStudentIDs |
Students.txt and every occurrence in Courses.txt.Courses.txt, extracts IDs, then scans Students.txt for each ID.ALTER TABLE Student ADD Email VARCHAR(100); does not require program modification.Data is stored once and related through keys. Normalisation removes duplication systematically.
| Normal Form | Key Requirement |
|---|---|
| 1NF | Eliminate repeating groups; each field contains atomic values. |
| 2NF | Be in 1NF and have no partial dependency of non‑key attributes on a part of a composite primary key. |
| 3NF | Be in 2NF and have no transitive dependency of non‑key attributes on other non‑key attributes. |
-- Unnormalised file (single table)StudentID | Name | DOB | Course1 | Course2 | Course3
---------------------------------------------------------
1 | Alice | 2005‑04‑12 | CS101 | MA101 | NULL
2 | Bob | 2004‑09‑30 | CS101 | PH101 | MA101
Create separate Student and Enrolment tables.
StudentStudentID | Name | DOB
-------------------------
1 | Alice | 2005‑04‑12
2 | Bob | 2004‑09‑30
Enrolment
StudentID | CourseCode
-----------------------
1 | CS101
1 | MA101
2 | CS101
2 | PH101
2 | MA101
The primary key of Enrolment is (StudentID, CourseCode); there are no non‑key attributes, so 2NF is satisfied.
Create a Course table for attributes that depend only on CourseCode.
CourseCourseCode | Title | Credits
------------------------------------
CS101 | Computer Sci | 3
MA101 | Mathematics | 3
PH101 | Physics | 3
Result: three tables in 3NF, no duplicated student or course information.
Built‑in rules that guarantee data quality.
DOB DATE,Credits INT CHECK (Credits BETWEEN 1 AND 6)
StudentID INT PRIMARY KEYFOREIGN KEY (StudentID) REFERENCES Student(StudentID)Email VARCHAR(100) UNIQUEName VARCHAR(50) NOT NULLCHECK (Credits BETWEEN 1 AND 6)SQL is a declarative language for defining structures (DDL) and manipulating data (DML).
CREATE TABLE Student (StudentID INT PRIMARY KEY,
Name VARCHAR(50) NOT NULL,
DOB DATE,
Email VARCHAR(100) UNIQUE
);
CREATE TABLE Course (
CourseCode CHAR(5) PRIMARY KEY,
Title VARCHAR(100) NOT NULL,
Credits INT CHECK (Credits BETWEEN 1 AND 6)
);
CREATE TABLE Enrolment (
StudentID INT,
CourseCode CHAR(5),
PRIMARY KEY (StudentID, CourseCode),
FOREIGN KEY (StudentID) REFERENCES Student(StudentID),
FOREIGN KEY (CourseCode) REFERENCES Course(CourseCode)
);
-- INSERTINSERT INTO Student VALUES (1, 'Alice', '2005-04-12', 'alice@example.com');
INSERT INTO Course VALUES ('CS101', 'Computer Science', 3);
INSERT INTO Enrolment VALUES (1, 'CS101');
-- UPDATE
UPDATE Student SET Email = 'alice.new@example.com' WHERE StudentID = 1;
-- DELETE
DELETE FROM Enrolment WHERE StudentID = 1 AND CourseCode = 'CS101';
SELECT – list the columns to return.FROM – specify the table(s) to read.WHERE – filter rows.JOIN (INNER, LEFT, etc.) – combine rows from two tables based on a condition.GROUP BY – aggregate rows that share a value.HAVING – filter groups after aggregation.ORDER BY – sort the result set.SELECT s.Name, c.TitleFROM Enrolment e
JOIN Student s ON e.StudentID = s.StudentID
JOIN Course c ON e.CourseCode = c.CourseCode
WHERE c.Credits >= 3
ORDER BY s.Name;
SELECT c.Title, COUNT(*) AS NumStudentsFROM Enrolment e
JOIN Course c ON e.CourseCode = c.CourseCode
GROUP BY c.Title
HAVING COUNT(*) > 1;
Write a CREATE TABLE statement for a Library entity that stores:
-- User A reads Alice’s email (alice@example.com)-- User B reads the same value
-- A updates to aliceA@example.com and commits
-- B updates to aliceB@example.com and commits
-- Final value = aliceB@example.com (A’s change lost)
With 2PL, both users would acquire an exclusive lock on the row, forcing one to wait until the other commits.
BEGIN TRANSACTION;UPDATE Student SET Email = 'bob@example.com' WHERE StudentID = 2;
INSERT INTO Enrolment VALUES (2, 'MA101');
COMMIT;
GRANT SELECT, INSERT ON Student TO clerk1;CREATE ROLE admin_role;GRANT ALL PRIVILEGES ON ALL TABLES TO admin_role;
GRANT admin_role TO alice;
CREATE VIEW StudentPublic ASSELECT StudentID, Name, DOB FROM Student;
GRANT SELECT ON StudentPublic TO public_user;
Student.Email).| Syllabus Feature | DBMS Capability that Demonstrates It |
|---|---|
| Logical data independence | Views and ALTER TABLE statements that do not require programme changes |
| Physical data independence | Indexes, clustering, partitioning – transparent to applications |
| Reduced redundancy | Normalisation (1NF‑3NF) and use of primary/foreign keys |
| Integrity constraints | PRIMARY KEY, FOREIGN KEY, UNIQUE, NOT NULL, CHECK |
| SQL query language | SELECT, JOIN, GROUP BY, HAVING, sub‑queries – declarative retrieval |
| Transaction management | BEGIN…COMMIT, ACID properties, locking protocols |
| Security & access control | GRANT/REVOKE, roles, column‑level views |
| Scalability | Indexes, query optimiser, partitioning, distributed DBMS |
| Aspect | File‑Based System | Relational Database |
|---|---|---|
| Data redundancy | High – same data duplicated in many files | Low – single‑table storage; normalisation removes duplication |
| Data integrity | Manual checks only | Built‑in constraints (PK, FK, UNIQUE, NOT NULL, CHECK) |
| Query capability | Procedural code required | Declarative SQL; joins, aggregates, ad‑hoc queries |
| Data independence | Low – schema changes force programme rewrites | High – logical & physical independence via views, ALTER |
| Concurrency control | None or simple file locking | ACID transactions; sophisticated locking & timestamp protocols |
| Security | OS file permissions only | Fine‑grained privileges, roles, column/row‑level views |
| Scalability | Limited by file size and manual indexing | Indexes, optimiser, partitioning, distributed DBMS |
Name, DOB).Suggested ER diagram (Student‑Course‑Enrolment):

Your generous donation helps us continue providing free Cambridge IGCSE & A-Level resources, past papers, syllabus notes, revision questions, and high-quality online tutoring to students across Kenya.