Computer Science
04782026–2028 syllabus

COMPUTER SCIENCE · CHAPTER 8

Databases and Boolean logic

Design relational data, write precise SQL queries and reason with logic gates.

Full syllabus4 connected sectionsSyllabus-aligned guide

LEARNING OBJECTIVES

What you will be able to do

  • describe fields, records, data types and primary keys
  • explain validation and relational database advantages
  • write SELECT queries with filtering and ordering
  • construct truth tables and logic circuits

AT A GLANCE

Syllabus0478Coverage2026–2028Sections4LevelFull syllabus

INTRODUCTION · THE BIG IDEA

Design relational data, write precise SQL queries and reason with logic gates.

Databases store structured records so information can be searched, updated and reported reliably. Keys and validation protect identity and data quality.

Boolean logic reduces decisions to true and false. The same AND, OR and NOT operations appear in conditions, truth tables and physical logic circuits.

01

SECTION 01

Database structure and keys

Core concept

A field stores one attribute and a record stores the fields for one entity. Suitable types include text, integer, real, date/time and Boolean. Field length and type reduce waste and prevent invalid operations.

A primary key must be unique and never null. A foreign key stores a matching primary-key value from another table, creating a relationship and reducing duplicated data. Referential integrity prevents references to missing records.

Database terms
TermMeaning
Fieldone attribute such as DateOfBirth
Recordall stored fields for one entity
Primary keyunique record identifier
Foreign keyfield linking to another table's primary key
02

SECTION 02

Validation and database use

Core concept

Range, type, format, length, presence and check-digit validation reject input that breaks rules. Verification checks copied data. Database systems support concurrent access, security permissions, backup, data independence and powerful queries.

A flat file repeats details and creates update, insertion and deletion anomalies. Related tables reduce redundancy but require thoughtful keys, relationships and query design.

ORIGINAL STUDY DIAGRAMDesign a simple database
1Identify entities
2List atomic fields
3Choose primary keys
4Move repeated groups to related tables
5Add foreign keys and validation
03

SECTION 03

SQL queries

Core concept

SELECT chooses fields, FROM names the table and WHERE filters records. AND requires both conditions; OR requires at least one. ORDER BY sorts the result using ASCENDING or DESCENDING as required by the current syllabus notation.

Text criteria use quotation marks. Numeric criteria do not. A result can select several fields while filtering using another field.

Original worked example

Filter and order a result

  1. Required fields are Name and Score from Students.
  2. Keep students with Score >= 70 AND House = "Blue".
  3. Order highest score first.

Answer: SELECT Name, Score FROM Students WHERE Score >= 70 AND House = "Blue" ORDER BY Score DESCENDING

04

SECTION 04

Boolean logic and gates

Core concept

AND outputs 1 only when both inputs are 1. OR outputs 1 when at least one input is 1. NOT reverses its input. NAND is NOT-AND, NOR is NOT-OR and XOR outputs 1 when inputs differ.

A truth table lists every possible input combination—2ⁿ rows for n inputs—and the output of each intermediate gate. To analyse a circuit, label intermediate outputs and evaluate one gate at a time. To draw one, translate brackets and operation order from the logic expression.

RULE 1
two-input combinations = 2² = 4 rows
RULE 2
n-input combinations = 2ⁿ rows
Two-input gates
ABANDORXOR
00000
01011
10011
11110

QUICK CHAPTER SUMMARY

The ideas to carry forward

  • Fields form records and keys preserve identity and relationships.
  • Validation enforces rules but does not guarantee truth.
  • SQL clauses select, filter and order data.
  • Truth tables make every Boolean input combination explicit.

QUICK REVISION CHECKLIST

Can you do each of these without your notes?

  • describe fields, records, data types and primary keys
  • explain validation and relational database advantages
  • write SELECT queries with filtering and ordering
  • construct truth tables and logic circuits