Relational databases

Start questions

Unofficial selected-topic practice.

Practice scope

Original English practice with worked guidance. Selected topics only. This is not a complete syllabus, official past-paper collection or predicted exam score. Check your own exam-board specification: these concepts are not certified against a particular board or exam year. Where a question shows a Cambridge 2027 reference, that is a conceptual placement only; no other exam board (such as Edexcel, AQA or OCR) is mapped, so do not assume this covers your board. Content here is written and checked with AI assistance; it has not been approved by an independent teacher or endorsed by any exam board.

160 original questions across 22 selected topic areas. No account or payment required to practise.

Cambridge International AS & A Level Computer Science (9618), examination year 2027: Conceptual alignment to official sources, not exam-board certification. Syllabus mapping and remaining coverage.

6 questions in this topic

Original questions with indicative worked guidance. Selected topics only.

All topics

Original practice in relational databases; indicative answers for unofficial practice.

6 of 6 questions shown

Loading saved responses

Question 1Hide question3 indicative marks

For Student(StudentID, Name) with StudentID declared PRIMARY KEY and Enrolment(StudentID, CourseID) with StudentID declared NOT NULL, explain the primary key and a foreign-key constraint referencing Student.

Cambridge 2027: Direct conceptual match

Primary-key uniqueness/non-null and non-null foreign-key referential integrity directly exercise listed terminology.

Conceptual placement only, not official Cambridge endorsement or complete syllabus coverage.

Show indicative guidance

Worked guidance

  1. Names may repeat, so a stable identifier distinguishes students. The foreign key together with NOT NULL requires every enrolment to reference an existing student. A nullable foreign key alone would allow a null reference, independently of how names are displayed.

Self-marking points

Tick what your working earned. The count is your own self-assessment.

Self-assessed: not counted yet. This question is worth 3 marks.

Examiner tip

A foreign key need not be unique in the referencing table.

Question 2Explain an update anomaly when DepartmentName is repeated in every employee row, and suggest a relational remedy.3 indicative marks

Explain an update anomaly when DepartmentName is repeated in every employee row, and suggest a relational remedy.

Cambridge 2027: Partial conceptual match

Repeated department names illustrate redundancy/update anomalies and a remedy, but no full dependency analysis or 3NF argument is required.

Conceptual placement only, not official Cambridge endorsement or complete syllabus coverage.

Show indicative guidance

Worked guidance

  1. Repeated descriptive data makes one fact have many storage locations. Separating department facts gives the name one authoritative row while employee records retain a reference to that entity.

Self-marking points

Tick what your working earned. The count is your own self-assessment.

Self-assessed: not counted yet. This question is worth 3 marks.

Examiner tip

Normalisation reduces logical redundancy; it is not merely file compression.

Question 3Given Scores(Name, Mark), write SQL to return names with Mark >= 70 sorted by descending Mark then ascending Name. Do not require duplicate removal.3 indicative marks

Given Scores(Name, Mark), write SQL to return names with Mark >= 70 sorted by descending Mark then ascending Name. Do not require duplicate removal.

Cambridge 2027: Direct conceptual match

Constructs SELECT/WHERE/ORDER BY using the inclusive threshold and tie-breaking order explicitly permitted by the DML list.

Conceptual placement only, not official Cambridge endorsement or complete syllabus coverage.

Show indicative guidance

Worked guidance

  1. Filter rows before presentation ordering: SELECT Name FROM Scores WHERE Mark >= 70 ORDER BY Mark DESC, Name ASC;. The second sort key makes ties deterministic by name.

Self-marking points

Tick what your working earned. The count is your own self-assessment.

Self-assessed: not counted yet. This question is worth 3 marks.

Examiner tip

Use >= rather than > so exactly 70 is included.

Question 4Orders contains (OrderID, CustomerID): (1,A), (2,A), (3,B). Customer contains IDs A, B and C once each. Determine row counts for an inner join on CustomerID and a customer-left join with Orders.3 indicative marks

Orders contains (OrderID, CustomerID): (1,A), (2,A), (3,B). Customer contains IDs A, B and C once each. Determine row counts for an inner join on CustomerID and a customer-left join with Orders.

Cambridge 2027: Partial conceptual match

Three INNER JOIN rows directly relate to the listed join; customer LEFT JOIN and null extension go beyond the stated INNER JOIN subset.

Conceptual placement only, not official Cambridge endorsement or complete syllabus coverage.

Show indicative guidance

Worked guidance

  1. Enumerate matches: A produces two joined rows and B one. C has no order, so an inner join excludes it while a left join preserves one customer row with null order columns.

Self-marking points

Tick what your working earned. The count is your own self-assessment.

Self-assessed: not counted yet. This question is worth 3 marks.

Examiner tip

A join is not necessarily one output row per customer.

Question 5A relation Enrolment(StudentID, CourseID, StudentName, CourseTitle, Grade) has key (StudentID, CourseID); StudentName depends only on StudentID and CourseTitle only on CourseID. Decompose it to remove the partial dependencies and explain how Grade is retained.4 indicative marks

A relation Enrolment(StudentID, CourseID, StudentName, CourseTitle, Grade) has key (StudentID, CourseID); StudentName depends only on StudentID and CourseTitle only on CourseID. Decompose it to remove the partial dependencies and explain how Grade is retained.

Cambridge 2027: Partial conceptual match

2NF dependency removal retains pair-specific Grade correctly; this does not request the required progression to, or judgement of, 3NF.

Conceptual placement only, not official Cambridge endorsement or complete syllabus coverage.

Show indicative guidance

Worked guidance

  1. Place each fact with the key that determines it. Names and titles describe single entities, while a grade describes one enrolment, so moving Grade into Student would lose course-specific information.

Self-marking points

Tick what your working earned. The count is your own self-assessment.

Self-assessed: not counted yet. This question is worth 4 marks.

Examiner tip

Use the supplied functional dependencies; do not invent a dependency from student to grade.

Question 6A bank transfer debits one account then credits another. Explain how atomicity and isolation address different risks if a crash or concurrent balance update occurs.4 indicative marks

A bank transfer debits one account then credits another. Explain how atomicity and isolation address different risks if a crash or concurrent balance update occurs.

Cambridge 2027: Board-neutral enrichment

ACID atomicity/isolation and serialisable transfer locking are not explicit syllabus DBMS requirements; do not equate data-integrity vocabulary with transaction theory.

Conceptual placement only, not official Cambridge endorsement or complete syllabus coverage.

Show indicative guidance

Worked guidance

  1. All-or-nothing treatment solves partial execution within one transfer. Concurrency is a separate issue: two valid transactions can still interfere unless the database enforces an appropriate isolation and update strategy.

Self-marking points

Tick what your working earned. The count is your own self-assessment.

Self-assessed: not counted yet. This question is worth 4 marks.

Examiner tip

Name the failure each property addresses rather than using 'ACID' without explanation.

All AS & A Level subjects