Easier to read with cream paper, a tint, more contrast or larger text? Choose your colours and text, once, for every page.

Preview

AESP task 3: Write a data dictionary with rules

This is the first page of the lesson. Read it and have a go at the activities. The rest is in the full lesson.

65 minutes

What does "size" mean here?

A builder gets your diagram and sees a field called size. Is it a number of centimetres, a word like "large", or a count of characters?

A page of descriptions answers questions like that before anybody has to ask.

Key words

WordWhat it means
Data dictionarya table that describes every attribute: its type, size, rules and an example
Data typethe kind of value an attribute holds, such as whole number, text or date
Field sizethe largest length or value an attribute may have
Validationa check that data is sensible when it goes in
Verificationa check that data was copied correctly, such as typing it twice
Data assurancethe checks that make data accurate and reliable
Attributeone fact about an entity, such as a name

The cells students fill in are left blank in this preview.

By the end of this lesson

Note

I can write a data dictionary with types, sizes and rules, and name the data assurance checks that go with it.

Starter

Have a go

Starter

3 questions
Have a go: your answers are marked here and then forgotten. Sign in if you would like your score kept, and to pick up where you left off.Sign in to keep your score

Your answers are marked here and are not kept. A college account keeps every student’s marks.

This is practice

Important

The real task comes from the exam board. This lesson uses an invented organisation and its own made-up data. Your teacher tells you how the real tasks are set and what you may bring.

Worked example: a dictionary for Customer

AttributeTypeSizeKeyRequiredRuleExample
customer_idWhole numbern/aPrimaryYesUnique, given by the system17
nameText40NoYesAt most 40 charactersMaya Ford
townText30NoNoMay be emptyHillside
date_joinedDate10NoYesA real date, YYYY-MM-DD2026-02-01
pointsWhole numbern/aNoYesZero or more3

The cells students fill in are left blank in this preview.

Choose a type and a size

Choose the smallest type that always fits. A whole number for a count, text for a name, a date for a date.

Money is best stored as whole pence, because a decimal number can be a tiny bit wrong. A phone number is text, not a number: you never add two of them, and a leading zero must stay.

Run it: a dictionary turned into a table

Code: sql
SELECT name, type, "notnull" AS required, pk AS is_key
FROM pragma_table_info('customer');

Data assurance in plain words

Validation checks a value when it goes in. Is it present? Is it the right type? Is it in range? Is it the right format? Is it short enough?

Verification checks it was copied right, for example by typing an email twice.

Write the rule in the dictionary. Then build it into the table, so the table refuses a bad value.

The lesson goes on

8 more parts of this lesson are in the full curriculum, with the tasks, the final check and the labs. A college account gives your students all of it.