6 fields fill a 11,520-byte data dictionary, 4 tables by 3 roles give 7 grants, and a 240 GB database needs 297.6 GB a week, with seven data types and two-table SQL.">
/en-tutor-prep-alevel-computer-science-dbms-sql/
/en-tutor-prep-alevel-computer-science-dbms-sql/
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 — DBMS and SQL: data dictionary, access rights, backup, seven data types and two-table queries (lesson-prep guide for tutors)

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.

Objectives — Students can: (1) state the five DBMS features with one failure each: data management with a data dictionary, data modelling, logical schema, data integrity, and security through backup and access rights; (2) say who uses the developer interface and the query processor and what each solves; (3) separate DDL, which changes structure through CREATE DATABASE, CREATE TABLE, ALTER TABLE, primary and foreign keys, from DML, which changes data through SELECT, INSERT, UPDATE and DELETE; (4) write CREATE TABLE with the right data type for each attribute out of CHARACTER, VARCHAR(n), BOOLEAN, INTEGER, REAL, DATE and TIME, and compute that CHARACTER(40) against VARCHAR(40) saves 4,000 bytes, 50 percent, over 200 names averaging 18 characters; (5) write two-table SELECT statements with WHERE (300 rows, 6.25 percent), ORDER BY, GROUP BY (96 classes at 50 rows each), INNER JOIN (4,800 rows down to 4,763, dropping 37 orphans), SUM, COUNT and AVG (mean 66.0); (6) maintain data with INSERT INTO, UPDATE and DELETE FROM, and explain why one UPDATE beats 80 edits in a flat file.

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

Start by making clear that a DBMS is not the database itself but the layer in front of it. Remove that layer and five things break. First, with no data dictionary nobody knows whether s_class is five characters or ten, or whether it may be empty, so three programs assume three different things. The dictionary is the catalogue: 14 tables and 96 fields, each with type, length, nullability, default and constraints, 120 bytes an entry, 11,520 bytes in total.
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

DDL changes structure only, and that must be nailed down. CREATE DATABASE makes an empty database; CREATE TABLE makes a table and declares each column type. Match the seven types to uses: CHARACTER is fixed-length text such as a two-letter grade code, VARCHAR(n) is variable-length text such as a name or address, BOOLEAN is true or false, INTEGER is a whole number such as a student or class number, REAL is a number with decimals such as a mark or fee, DATE is a date and TIME is a time of day.
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

DML touches data only. Use an enrolment table of 4,800 rows and a student table of 1,200 rows to teach four modifiers, each with a row count. WHERE filters: Mark >= 80 returns 300 rows, 6.25 percent. ORDER BY sorts, changing order but not count. GROUP BY folds rows into one per group: by class there are 96 groups at 50 rows each, and with COUNT, AVG and SUM you get the count, the mean mark of 66.0 from 316,800 over 4,800, and 14,400 credits from 4,800 times 3.
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
Sanity check (teach this): Six checks. First, DDL and DML must not be mixed: CREATE and ALTER change structure, while SELECT, INSERT, UPDATE and DELETE change data, and calling UPDATE DDL is the commonest lost mark. Second, CHARACTER is fixed while VARCHAR is variable plus a length prefix, so 200 names of 18 characters save 4,000 bytes, not half by magic. Third, GROUP BY returns one row per group, so mean per class is 96 rows, not 4,800, and students must say so. Fourth, INNER JOIN reduces rows here, 4,800 down to 4,763, losing 37; an answer of more rows has treated the join as a copy. Fifth, UPDATE needs WHERE or every row changes, the most expensive mistake in practice. Sixth, backup cuts both ways: incremental saves 5.65 times the space, but a restore stacks the full and every increment, and the full alone already takes 33.3 minutes for 240 GB.

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)

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.

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