files repeat 1,200 names at a cost of 60,000 wasted bytes, 4,800 enrolments need a 9-character composite key, and 1NF to 3NF each remove one kind of duplication.">
/en-tutor-prep-alevel-computer-science-database-concepts-normalisation/
/en-tutor-prep-alevel-computer-science-database-concepts-normalisation/
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

A-Level Computer Science — Database Concepts and Normalisation: five file-based problems, twelve terms, E-R diagrams and 1NF to 3NF (lesson-prep guide for tutors)

A-Level Computer Science — Database Concepts and Normalisation: five file-based problems, twelve terms, E-R diagrams and 1NF to 3NF (lesson-prep guide for tutors)

  • 2026-11-27

Students can say a database is a collection of tables, then stall when asked why three spreadsheets are a bad idea. This chapter ties each of the five file-based problems to a figure: 60,000 bytes of duplicated names across 3 files, 120 edits for 40 address changes, and 2,400 empty cells in six subject columns. It then uses 4,800 enrolments to remove repetition twice, at 2NF and at 3NF.

Objectives — Students can: (1) state the five limitations of a file-based approach (data redundancy, update anomalies, insert anomalies, delete anomalies and program-data dependence) with one concrete situation each; (2) explain how a relational database answers them, storing each fact once, linking tables with keys and replacing hard-coded reports with queries; (3) use the terminology correctly, especially primary key against candidate key and secondary key, and foreign key against referential integrity; (4) compute the cost of duplication, 1,200 names of 25 bytes across 3 files giving 90,000 bytes against 30,000 stored once, a saving of 60,000 bytes or 66.7 percent; (5) draw an E-R diagram for three entities and explain why a many-to-many relationship needs a junction table split into two one-to-many relationships; (6) decide whether a set of tables is in 3NF by looking for repeating groups, then partial dependencies, then transitive dependencies, and show the design after each step.

01 Prerequisites (3-minute check)

If any of these fails, fix it before the lesson starts.

Skill Quick check Pass mark
Field and record In a class register, what is a row and what is a column A row is a record, a column is a field
The job of a primary key Student ID or name, which one can be the primary key Student ID, because it is unique and never changes
A one-to-many relationship One tutor teaches many students, which relationship is that One-to-many, with the tutor ID stored on the many side
Simple multiplication What is 1,200 times 25 times 3 90,000
First normal form Can one cell hold three subjects No, one cell holds one value

02 Lesson flow (60 minutes)

Time Stage Tutor does Student does
0-8 min Opening: five illnesses in three spreadsheets Use one set of student data held in three files and name each problem Name at least three problems with a situation each
8-20 min How relational answers them, plus twelve terms One fact stored once, keys link tables, each term with a definition and an example Classify a field as primary, candidate or foreign key
20-32 min E-R diagrams and three cardinalities Draw Student, Course and Tutor, then resolve the many-to-many Draw the junction table and name the two one-to-many links
32-44 min 1NF and 2NF Remove the repeating group, then the partial dependency, with bytes saved at each step Split an unnormalised table into 1NF and then 2NF
44-54 min 3NF and the judgement drill Remove the transitive dependency and name each violation in a six-column table Say which column breaks which normal form
54-60 min Indexing, sanity check and exit check 50,000 records at 2,500 ms against 1.6 ms with an index Give one benefit and one cost of an index

03 Teaching script (read it out)

Scene 1: Three files, five illnesses

Do not start with databases. Start with a real mess: a tutoring centre keeps student data in three files, one for enrolment, one for fees and one for marks, each holding the student name and address for 1,200 rows. An address is changed in one file and not in the other two, so the same student now has two addresses in two files. That is redundancy and inconsistency.
The second illness is the update anomaly: 40 students move each term, so three files need 120 edits instead of the 40 that the fact deserves, and one missed file recreates the inconsistency. The third is the insert anomaly: a new student has not paid yet, so the fees file has no row for them, and unpaid now looks the same as not enrolled. The fourth is the delete anomaly: deleting the fee record also deletes the only copy of the address. The fifth is program-data dependence: 5 reports each hard-code the 3 files they read, 15 references in total, so one new column means 15 edits.
Put the five illnesses on the left of the board and four relational answers on the right: store each fact once, so the address lives only in the student table; link tables with primary and foreign keys, so an enrolment stores only the student ID and the course ID; replace hard-coded reports with queries; and protect the data with constraints and permissions. No syntax in this scene, only the instinct that duplication is debt.
Student task: give one example they have seen for each illness, then say which single design change they would make first.

Say this: a fact stored twice has two versions, and two versions will disagree one day.

Scene 2: Twelve terms, one at a time

Teach the terms against the three files, otherwise students memorise English words. An entity is a thing worth recording, such as a student, a course or a tutor; a table is how that entity is stored; a record or tuple is one row; a field or attribute is one column.
The three keys are examined every year. A primary key is the field or fields chosen to identify a row uniquely; a candidate key is any field that could serve, such as student ID or identity card number; a secondary key is a non-unique field used for searching, such as class or surname, and normally carries an index. A foreign key is another table primary key placed here to make the link, such as the student ID in the enrolment table. Referential integrity is the rule that every foreign key value must exist in the other table, otherwise the row is an orphan. With figures: of 4,800 enrolments, 37 point at a deleted student, 0.77 percent, and those 37 are exactly what referential integrity rejects.
Teach cardinality with one test each: one-to-one means at most one on each side, one student one account; one-to-many stores the foreign key on the many side, 60 tutors and 4,800 enrolments giving 80 each on average; many-to-many needs a junction table that turns it into two one-to-many links, which is how students and courses work, with the composite key (student ID, course ID).
Student task: classify four fields, student ID, identity card number, class and the student ID inside the enrolment table, as primary, candidate, secondary or foreign key, with one reason each.

Say this: the primary key is the one you chose, the candidate keys are all that qualify, and a foreign key is somebody else primary key.

Scene 3: E-R, normalisation and that factor of 1,562

An E-R diagram only needs three things: entities as boxes, relationships as diamonds or connecting lines, and cardinality written at the ends. Students and courses are many-to-many, so add an enrolment entity; tutors and courses are one-to-many, so the tutor ID sits in the course table. Then ask: under this design, can the same student enrol twice in the same course? No, because the junction table primary key is the pair of columns.
Normalisation in three steps, each with arithmetic. 1NF: one value per cell, no repeating group. The original table has 6 subject columns, but 1,200 students take 4 subjects on average, so 2,400 of 7,200 cells are empty and the fill rate is only 66.7 percent. One row per enrolment gives 4,800 rows with no empty cell. 2NF: no field depends on only part of a composite key. The enrolment key is (student ID, course ID), but the student name depends on the student ID alone, so it moves to the student table, cutting 4,800 copies to 1,200, 86,400 bytes to 21,600, saving 64,800 bytes or 75 percent. 3NF: no field depends on another non-key field. The enrolment table holds the tutor ID and the tutor name, but the name depends only on the tutor ID, so it moves to the tutor table, cutting 4,800 copies to 60, 96,000 bytes to 1,200, saving 94,800 bytes or 98.75 percent.
Close with indexing, the answer to why relational is fast: scanning 50,000 records takes 25,000 comparisons on average at 0.1 ms each, 2,500 ms, while a binary search through an index needs 16 comparisons, 1.6 ms, 1,562 times faster. The cost is space and the need to update every index on each insert or update.
Student task: take a six-column table (student ID, name, course ID, course name, tutor ID, tutor name), name the normal form each column breaks, and write the three tables after splitting.

Say this: 1NF splits the cell, 2NF splits half a key, 3NF splits a non-key; every split leaves each fact stored once.

04 Question types and worked steps

Type Example Steps Answer
Duplication cost from file count and field length 3 files, 1,200 students, 25-byte name Multiply students by field length by files, then compare with one copy 90,000 bytes against 30,000, saving 60,000 (66.7 percent)
Deciding whether tables are in 3NF Enrolment (student ID, course ID, name, course name, tutor ID, tutor name) Look for a repeating group, then a field depending on half the key, then a field depending on a non-key field 1NF holds; name and course name break 2NF; tutor name breaks 3NF, so split into three tables
Resolving many-to-many Students and courses are many-to-many Add a junction table whose key is the two primary keys, giving one-to-many on both sides 4,800 enrolment rows with a 9-character composite key
Index speed-up from record count 50,000 records, 0.1 ms per comparison Half the records for a scan, and powers of two for the binary search 2,500 ms against 1.6 ms, 1,562 times faster
Naming a file-based limitation with a situation A new student has not paid yet Insert anomaly: the fees file has no row, so unpaid cannot be recorded Insert anomaly, because one fact is forced to arrive with another
Sanity check (teach this): Five checks. First, duplication is students times field length times files, 1,200 by 25 by 3 giving 90,000; an answer below 30,000 has the three copies and the single copy swapped. Second, normalisation does not lose data: every enrolment survives, all 4,800 rows, and a smaller number means data was dropped. Third, 2NF and 3NF differ by what the field depends on, part of a composite key for 2NF and another non-key field for 3NF, and neither is simply repetition. Fourth, a foreign key draws its values from the other primary key, so the 37 orphans must be deleted or repaired, never left as unclassified. Fifth, an index speeds up reading, not writing: 50,000 records drop from 2,500 ms to 1.6 ms, but every insert and update must also maintain the index, so heavily updated tables should not carry many.

05 Independent practice (3 questions)

Question Answer What to watch
A club keeps 800 members in three files, each holding a 20-byte name. How many bytes do the names take across three files, how many when stored once, and what percentage is saved? 48,000 bytes against 16,000, saving 32,000 bytes, 66.7 percent Multiply members by length and by the file count; the denominator is the three-file total
A table has four columns: student ID, name, course ID, course name, with the key (student ID, course ID). Is it in 2NF, and how should it be split? Not in 2NF: the name depends only on the student ID and the course name only on the course ID, each on half the key. Split into student (student ID, name), course (course ID, course name) and enrolment (student ID, course ID), which is then in 3NF For 2NF ask one question: can this field be identified from half the key alone
A table has 80,000 records, each comparison takes 0.08 ms, and an index supports a binary search. How many comparisons does the search need, and how much faster is it than a scan? A scan averages 40,000 comparisons, 3,200 ms; a binary search needs 17, 1.36 ms, 2,353 times faster Two to the 16 is 65,536 and two to the 17 is 131,072, so 80,000 needs 17

06 Common mistakes and what to say

Mistake Student writes Say this
Treating primary key and candidate key as the same Saying both student ID and identity card number are primary keys Both are candidate keys, but only one is chosen as the primary key; the rest are protected by unique constraints.
Thinking normalisation deletes data Saying 4,800 enrolments become a few hundred rows Splitting removes duplicated columns, not enrolments; all 4,800 rows stay, and fewer means data loss.
Confusing 2NF with 3NF Seeing repetition and calling it a 3NF problem Check for a repeating group first (1NF), then a dependency on half a composite key (2NF), then a dependency on another non-key field (3NF).
Assuming every index is worth having Saying every column should be indexed An index speeds up searching, 50,000 records falling from 2,500 ms to 1.6 ms, but each insert and update maintains it, and a low-selectivity column such as gender gains almost nothing.

07 Homework (paper, section and question numbers)

08 Exit check (last 5 minutes)

Question Answer Decision
One limitation The expensive part of a file-based approach is storing one fact many times No answer on duplication means scene 1 needs redoing
One difference 2NF splits half a key, 3NF splits a non-key Saying they are the same means scene 3 needs redoing
One figure 3 files hold 1,200 names in 90,000 bytes, once is 30,000 Saying they are equal means scene 2 needs redoing

09 Tutor FAQ

Why not keep one big table with everything in it?

One big table is the unnormalised one: 6 subject columns leave 2,400 cells empty, names and tutor names repeat for every enrolment, and one address change touches many rows. A relational design puts each kind of fact in one table and links them by key; the cost is joins, the gain is one copy of each fact that stays consistent.

Does 3NF not mean many joins?

Yes, which is why real systems add indexes, or controlled duplication such as a pre-computed reporting table, after normalising. What the exam asks for is the design: put each fact in the right place at 3NF, then explain how any duplication added for speed is kept in step.

Are an index and a primary key the same thing?

No. A primary key is a rule about the data, unique and not null; an index is a search structure, a B-tree or a hash. The database usually indexes the primary key automatically, but any frequently searched column can carry one, so a table has many indexes and one primary key. The 50,000-record comparison is the index at work, 2,500 ms down to 1.6 ms.

Find a tutor — freeTutor Registration →

A TutorZone lesson-prep guide. Written by the TutorZone team; questions and lesson flow are original and are not taken from any school or publisher material.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →