Data & representation · Both

Databases & SQL Basics

Databases organise data so it can be stored, searched and updated efficiently.

Structure

• **Table** – collection of related data • **Record** – one row (one item) • **Field** – one column (one attribute) • **Primary key** – unique identifier for each record

SQL and validation

Simple query pattern: SELECT fields FROM table WHERE condition Validation checks data on entry (range, type, presence, format) to reduce errors.

Worked example

SQL to get all pupils in Year 11?

Solution: SELECT * FROM Pupils WHERE Year = 11

Practice questions

1. What is a primary key?

2. Name two validation checks.