A member who is 150 years old
Oakfield Youth Club is made up. Its members are aged 11 to 19. One morning the list shows a member aged 150 and another with no phone number.
Nobody meant to do it. A typing slip is enough. A good design stops bad data before it is saved, and shows how the tables link.
By the end of this lesson
Note
I can choose a validation (a test on entered data) for a field and show how tables link in a diagram.
Key words
| Word | What it means |
|---|---|
| Validation | a check that data is sensible when it is entered |
| Presence check | a check that a field is not left empty |
| Range check | a check that a number is between two limits |
| Format check | a check that data follows a set pattern |
| Entity relationship diagram | a picture of the tables and how they link |
| One-to-many | one record in one table links to many in another |
The cells students fill in are left blank in this preview.
Starter: what you already know
Have a go
Starter: what you already know
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.
Six checks keep data sensible
A list check accepts only values from a set. A rule check tests a rule, such as an end date after a start date. A text check tests the letters, such as a limit on length.
A presence check refuses an empty field. A range check sets limits. A format check tests a pattern, such as a phone number that starts 07.
Checks for the members table
| Field | Check | What it refuses |
|---|---|---|
| last_name | Presence check | A blank last name |
| age | Range check, 11 to 19 | Ages of 9 or 150 |
| phone | Format check | A number that is too short or does not start 07 |
| weekday | List check | Any word that is not a day |
| first_name | Text check, 30 characters | A name longer than 30 characters |
The cells students fill in are left blank in this preview.
Check
Have a go
Check
3 questionsYour answers are marked here and are not kept. A college account keeps every student’s marks.