A-Level Computer Science — DBMS and SQL: data dictionary, access rights, backup, seven data types and two-table queries (lesson-prep guide for tutors)
- 2026-11-27
Students can write CREATE TABLE, then answer what a DBMS does with stored data. This chapter ties each of the five features to a checkable artefact: a 11,520-byte dictionary for 96 fields and 7 grants out of 12 cells for 4 tables across 3 roles. It then uses a 240 GB backup cycle and one two-table query to separate DDL from DML.
01 Prerequisites (3-minute check)
If any of these fails, fix it before the lesson starts.
| Skill | Quick check | Pass mark |
|---|---|---|
| Tables and fields | What is one column of a table called | A field or attribute |
| Primary and foreign keys | How does an enrolment link to a student | By a foreign key, the student ID |
| Comparison operators | How is a mark of 80 or more written | Mark >= 80 |
| Sorting against grouping | Sorting students by class, and counting students per class, which is grouping | Counting per class is GROUP BY, sorting is ORDER BY |
| Fixed against variable length | Which one saves space, fixed length or variable length | Variable length saves space but costs a little processing |
02 Lesson flow (60 minutes)
| Time | Stage | Tutor does | Student does |
|---|---|---|---|
| 0-8 min | Opening: a DBMS is not a storage location | Describe five things that break with no DBMS | Name three features and the failure each prevents |
| 8-20 min | Five features and two tools | Data dictionary, modelling, logical schema, integrity, security; developer interface and query processor | Sort a job into the right feature |
| 20-30 min | DDL: create a database, create and alter a table | Write CREATE TABLE, choose each data type, add keys | Choose the right type for four attributes |
| 30-42 min | DML: four SELECT modifiers | WHERE, ORDER BY, GROUP BY and INNER JOIN, each written and counted | Write a two-table query and say how many rows return |
| 42-52 min | Maintenance and the idea of a transaction | INSERT, UPDATE and DELETE with referential integrity and backup | Pick one statement and name the risk |
| 52-60 min | Backup, sanity check and exit check | 240 GB giving 297.6 GB a week against 1,680 GB | Give one benefit and one cost of incremental backup |
03 Teaching script (read it out)
Scene 1: Five small apocalypses without a DBMS
Second, with no data modelling or logical schema each program imagines its own shape, and one changed column breaks a reader. Third, with no integrity constraints an enrolment can point at a student who does not exist, and 37 orphans go unnoticed. Fourth, with no security anyone who logs in can read marks and addresses. Fifth, with no backup routine one failed disk takes 240 GB of data with it.
Then the two tools: the developer interface serves the people who design and maintain the database, creating tables, reading the schema, writing queries and reading a plan; the query processor sits in front of every query and parses, validates, optimises and executes it, which is why two spellings of the same query can differ by hundreds of times.
Student task: sort five jobs: checking whether a column may be empty, stopping a student ID that does not exist, limiting a teacher to their own class marks, restoring last night after a disk failure, and making a query ten times faster.
Say this: a DBMS is the rules, the catalogue, the security and the maintenance of a database.
Scene 2: DDL: build the structure before any data
Teach fixed against variable with arithmetic: 200 names in a 40-character column take 8,000 bytes as CHARACTER(40); with VARCHAR(40) and 18 characters on average, plus a 2-byte length prefix per value, they take 4,000 bytes, saving 4,000 bytes or 50 percent. The cost is reading the prefix and, when a value grows, possibly moving the row.
Keys go inside CREATE TABLE: PRIMARY KEY (StudentID) guarantees uniqueness, FOREIGN KEY (StudentID) REFERENCES Student (StudentID) guarantees referential integrity. ALTER TABLE changes the definition, not the data, and that sentence prevents the classic error.
Student task: choose types for four Club attributes and write the CREATE TABLE: a four-character club ID, a name of up to 30 characters, a fee with decimals, and whether the club still runs.
Say this: DDL draws the boxes and DML puts things in them.
Scene 3: DML: one query, four questions
INNER JOIN is the most examined and most misread: 37 of the 4,800 enrolments point at a deleted student, so the join returns 4,763 rows because only matched rows survive. Make students say why: 37 rows disappear because those student IDs do not exist in the student table.
Three maintenance statements: INSERT INTO adds a row; UPDATE changes only the rows named by WHERE, and after moving a tutor name into a tutor table one UPDATE replaces 80 edits in a flat file; DELETE FROM removes rows, so teach what the foreign key rule does, block the delete or cascade it. Close with the query processor in one figure: a scan of 4,800 rows at 0.02 ms each is 96 ms, while an index needs 13 comparisons, 0.26 ms, 369 times faster.
Student task: write a query listing student name and mark for marks of 80 or more, highest first, then say that it uses two tables and returns 300 rows.
Say this: WHERE removes rows, ORDER BY reorders them, GROUP BY folds them, and JOIN widens the table.
04 Question types and worked steps
| Type | Example | Steps | Answer |
|---|---|---|---|
| Sorting a job into a DBMS feature | Limiting a teacher to their own class marks | Ask whether it touches the catalogue, the model, the schema, a constraint or permissions | Security through access rights |
| Choosing types and writing CREATE TABLE | A four-character club ID, a fee, a true or false flag | Fixed text is CHARACTER, decimals are REAL, true or false is BOOLEAN | CREATE TABLE Club (ClubID CHARACTER(4) PRIMARY KEY, ClubName VARCHAR(30), Fee REAL, Active BOOLEAN) |
| WHERE with ORDER BY | Marks of 80 or more, highest first | Filter with WHERE, then sort with ORDER BY DESC | SELECT StudentName, Mark FROM Enrolment WHERE Mark >= 80 ORDER BY Mark DESC, 300 rows |
| GROUP BY with COUNT or AVG | How many students per class and the mean mark | Group by class, then aggregate with COUNT or AVG | 96 groups at 50 rows each, mean 66.0 |
| INNER JOIN across two tables | Student name and mark in one list | FROM one table INNER JOIN the other ON the keys are equal | 4,763 rows, dropping 37 orphans |
| Comparing two backup cycles | 240 GB changing 4 percent a day | One full plus six incremental against seven fulls | 297.6 GB against 1,680 GB, 5.65 times less |
05 Independent practice (3 questions)
| Question | Answer | What to watch |
|---|---|---|
| Write the CREATE TABLE for Club: a four-character club ID as primary key, a name of up to 30 characters, a fee with decimals and a true or false flag. Then write one INSERT. | CREATE TABLE Club (ClubID CHARACTER(4) PRIMARY KEY, ClubName VARCHAR(30), Fee REAL, Active BOOLEAN); INSERT INTO Club VALUES (‘C001’, ‘Chess Club’, 120.00, TRUE), 4 attributes and 4 values | Match each type: fixed text, variable text, decimal, true or false |
| Write a query for the number of students in each class, ordered by class. How many rows return, and how many per group on average? | SELECT Class, COUNT(*) FROM Student GROUP BY Class ORDER BY Class; 96 rows, 12.5 per group on average | GROUP BY returns one row per group and COUNT(*) counts rows in each group |
| Write a query listing student name and mark from two tables, only marks of 80 or more, highest first. Why might it return fewer than 300 rows? | SELECT Student.StudentName, Enrolment.Mark FROM Student INNER JOIN Enrolment ON Student.StudentID = Enrolment.StudentID WHERE Enrolment.Mark >= 80 ORDER BY Enrolment.Mark DESC; any of the 300 rows that is an orphan has no match, so INNER JOIN drops it | INNER JOIN keeps only matched rows, and orphans never appear |
06 Common mistakes and what to say
| Mistake | Student writes | Say this |
|---|---|---|
| Calling UPDATE a DDL statement | Saying UPDATE changes the table structure | UPDATE changes values in rows, which is DML; changing structure is ALTER TABLE, which is DDL. |
| Expecting GROUP BY to keep every row | Saying the mean per class returns 4,800 rows | GROUP BY folds each group into one row, so 96 classes give 96 rows; drop the GROUP BY to see every row. |
| Thinking a join always adds rows | Saying two joined tables return the sum of both | INNER JOIN keeps only matched rows, so 4,800 becomes 4,763, losing 37 orphans. |
| Writing UPDATE or DELETE without WHERE | Saying DELETE FROM Student deletes one student | DELETE FROM Student deletes every student; deleting one needs WHERE StudentID = and so does UPDATE, the costliest error in practice. |
07 Homework (paper, section and question numbers)
- A-Level Computer Science chapter index — Every chapter in this subject
- All lesson-prep guides — Other subjects in the same series
- Redo this chapter — Practice questions 1 to 3: CREATE TABLE with four attributes, COUNT grouped by class, and the two-table INNER JOIN
08 Exit check (last 5 minutes)
| Question | Answer | Decision |
|---|---|---|
| One difference | DDL changes structure, DML changes data | Saying they are the same means scene 2 needs redoing |
| One direction | INNER JOIN only drops unmatched rows | Saying it always adds rows means scene 3 needs redoing |
| One figure | 240 GB needs 297.6 GB a week against 1,680 GB for seven fulls | Saying they are equal means scene 1 needs redoing |
09 Tutor FAQ
If one SQL statement already answers a question, why study the dictionary and schema?
Because the query processor needs the schema to know each type and constraint, and a developer needs the dictionary to know which of the 96 fields may be empty and which is a foreign key. Without that catalogue the 14 tables live in somebody memory, and one structural change breaks a reader. When an exam asks what a DBMS provides, the data dictionary is the answer that separates it from a file-based approach.
How should CHARACTER and VARCHAR be chosen?
By whether the length is stable. Fixed codes such as a two-letter grade or a four-character club ID use CHARACTER, which is fixed and fast to compare; names and addresses use VARCHAR because their length varies widely. 200 names averaging 18 characters take 8,000 bytes as CHARACTER(40) and 4,000 as VARCHAR(40), saving 4,000 bytes, at the price of a 2-byte length prefix per value.
How deep does INNER JOIN need to go for this syllabus?
The syllabus asks for INNER JOIN only, so keeping matched rows from both sides is enough. The figures make it concrete: 4,800 enrolments include 37 orphans, so the join returns 4,763. Keeping students with no enrolment needs an outer join, which is outside this section of 9618.
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.



