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

Free lesson

Task 1 B: Netheret data: ERD, data dictionary and validation

The whole lesson, free. Read it and have a go at the activities. To work the tasks and labs in the real lesson, press Start lab, with no account needed.

60 minutes

A quick check that you are not a bot, then your own lab opens on the interactive lesson.

Already have an account? Sign in

The contact list with three Sams

Your phone has three contacts called Sam. One has two numbers. One changed number last year, and you never updated it.

A list like that is a mess, and it is tiny. Netheret will store thousands of requests, visits and fixes.

Before anyone writes code, the data needs a design: what is stored, how it links, and what counts as a valid value.

Key words

WordWhat it meansExample
EntityA thing the app stores data about. It becomes a table.Ticket
AttributeOne fact stored about an entity. It becomes a field.priority
Primary keyA field that is different for every row.id
Foreign keyA field that points at a row in another table.company_id
Data dictionaryA table that describes every field: its type, size and rules.
Data typeThe kind of value a field holds.whole number, text, date
ValidationChecking a value is sensible before it is stored.
NormalisationSplitting data into tables so each fact is stored once.

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

By the end of this lesson

Note

I can write a data dictionary entry with a data type and a validation rule.

Starter: last lesson

Have a go

Starter: last lesson

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

An ERD shows the tables and their links

An entity relationship diagram (ERD) shows each entity as a box and each link as a line.

The ends of a line show how many. One company has many tickets. Each ticket has many updates. A ticket may have no job, or several.

Each link is made by a foreign key. Ticket stores company_id, which points at one row in Company.

The Netheret ERD

erDiagram
  Company |o--o{ User : "has customer contacts"
  Company ||--o{ Ticket : "raises"
  User ||--o{ Ticket : "raised_by"
  User |o--o{ Ticket : "assigned_to"
  Ticket ||--o{ TicketUpdate : "has"
  User ||--o{ TicketUpdate : "writes"
  Ticket |o--o{ Job : "may lead to"
  Company ||--o{ Job : "is visited in"
  User ||--o{ Job : "engineer for"
  User ||--o{ Article : "writes"

Check: reading the ERD

Have a go

Check: reading the ERD

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

Match each entity to what it stores

Have a go

Loading…

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

A data dictionary describes every field

The ERD shows the shape. The data dictionary gives the detail a developer needs to build each table.

For each field, give its name, data type, size, rules and an example. Keep one naming convention (a fixed way to write names). Here, tables are written like TicketUpdate and fields like raised_by_id.

A field that may be empty is marked "can be empty", such as resolved_at before a fix.

Worked example: the Ticket table

FieldTypeRuleExample
idInteger (whole number)Primary key, numbered automatically7
referenceText, 8NTH- then 4 digits, uniqueNTH-0007
titleText, 100Required, 5 to 100 charactersPrinter offline
descriptionText, 2000Required, up to 2000 charactersShows error E3 since Monday
categoryText, 10One of `hardware`, `software`, `network`, `account`, `other`hardware
priorityText, 8One of `low`, `medium`, `high`, `critical`high
statusText, 8One of `new`, `open`, `waiting`, `resolved`, `closed`. Starts as `new`.open
company_idIntegerForeign key to Company3
raised_by_idIntegerForeign key to User12
assigned_to_idIntegerForeign key to User, can be empty5
tierInteger1, 2 or 3. Starts as 1.2
created_atDate and timeSet by the app when saved2026-03-03 09:14
updated_atDate and timeSet by the app on every change2026-03-03 11:02
resolved_atDate and timeCan be empty. Set when status becomes resolved.2026-03-03 15:40

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

Check: the data dictionary

Have a go

Check: the data dictionary

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

The design says how errors are handled

A form sends everything as text. So the back end must check each value, turn it into the right type, and explain any problem.

Plan four things. Validation rules: length, range, a value from a list. Type casting (turning the text "90" into the number 90). Limits on length, so a field cannot overflow. Messages that tell the user how to fix it.

Try it: check a new request

Code: python
CATEGORIES = ["hardware", "software", "network", "account", "other"]


def check_request(title, category):
    errors = []
    title = title.strip()
    if len(title) < 5 or len(title) > 100:
        errors.append("Title: use 5 to 100 characters.")
    if category not in CATEGORIES:
        errors.append("Category: choose one from the list.")
    return errors


print(check_request("Printer offline", "hardware"))
print(check_request("PC", "printer"))

# Add a third line: a good title with the category "account".

Make a free account to save your work and track your progress.

A common mistake

Warning

Many students think one big table is simpler. It is, for a day. Then a company moves, and its address must change in hundreds of tickets. Store each fact once. Company details live in Company; a ticket only stores company_id.

Your turn: check a job's length

A manager types how long a job will take. Finish check_duration so it gives back an empty string for a whole number of minutes from 15 to 480. For anything else, it gives back the message in the comment. Test 15, 480, 14, 481, an empty box and "ninety".

Code: python
def check_duration(text):
    # The job form sends the duration as text, such as "90".
    # Give back "" when it is a whole number of minutes from 15 to 480.
    # Otherwise give back exactly this message:
    # "Enter a whole number of minutes from 15 to 480."
    return None

Make a free account to save your work, or press Start lab to work through the whole lesson.

Normalisation: why updates have their own table

BeforeProblemAfter
Ticket has fields update1, update2, update3A fourth update has nowhere to goA TicketUpdate table, one row per update
Ticket stores the company name and phoneChange the phone and old tickets disagreeCompany table, linked by company_id
Job stores the engineer's nameA renamed engineer appears twiceJob stores engineer_id, a link to User

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

Your turn: the full data design

Make the full Netheret data design. Part 1. Draw the ERD with all six entities: User, Company, Ticket, TicketUpdate, Job and Article. Show each link and how many. Part 2. Write a data dictionary for User, Company, TicketUpdate, Job and Article, the same way as Ticket. Use the fields from the class plan, such as role, text_size and high_contrast on User, and kind, scheduled_start and duration_minutes on Job. Part 3. Under each table, write one line in plain words for Netheret's managers.

A teacher marks this in a college. Nothing you write here is kept: it goes when you leave the page.

Make a free account to save your work, or press Start lab to work through the whole lesson.

Exit quiz

Have a go

Exit quiz

5 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

Teach this lesson with your class

On a college account your students work the tasks and the labs as well, and every mark is kept for you.