Topic module

Testing SQL Operations

Design and interpret tests that show SQL operations work correctly.

Long-form learning
Concept to Risk to Memory to Check-up

How to study National 5 Computing Science

Move from functional requirements to designs and implementation, trace data and code carefully, and support testing and evaluation with evidence.

Core concepts

Concept 1

A database test identifies the operation, starting data and expected output or data change.

Exam cue: Predict the exact rows, fields and order before executing a query.

Concept 2

SELECT tests should distinguish included, excluded and ordered records.

Exam cue: Inspect stored data after INSERT, UPDATE or DELETE rather than relying only on a success message.

Concept 3

Change-operation tests should confirm intended records change while unrelated records remain unchanged.

Risk pitfalls and guardrails

Using the SQL statement itself as the expected result.

Guardrail: Check option route, data type, valid boundary, loop condition, array index, identifier and expected output before committing to the response.

Checking one changed row without checking unintended side effects.

Guardrail: Check option route, data type, valid boundary, loop condition, array index, identifier and expected output before committing to the response.

Memory anchors

Query test

State starting records, SQL operation and exact expected rows, fields and order.

Boundary record

Include data at or near a search criterion boundary.

AND test

Use records that satisfy both conditions and records that satisfy only one.

OR test

Use records that satisfy either condition plus a record satisfying neither.

Change test

Confirm the intended record changes and other records do not.

Join test

Use known linked and unlinked key values to verify the equi-join result.

Checkpoint rule

Do the check-up only after you can summarize each concept in one sentence and identify one dangerous pitfall from memory.

Knowledge Check (after reading)

Short check-up to confirm understanding of this module.

Check-up Questions

1-2 question checkpoint

Which statement raises product 9's price to 12.50?

Which statement removes all records with Archived=true?

Answer all questions to submit.

Next step personalized recommendations

What is Pass Harbor?

Completely free exam prep for 247 UK exams.

  • Practice questions
  • Flashcards
  • Study guides
  • Mock exams
  • No registration
  • No paywall
  • Start instantly
No more expensive exam prep. Quality study tools should be accessible to everyone.