GoalDesign, test and evaluate a small database on paper, for a purpose you choose.
New words
purpose · what the database is forevaluate · to judge how well a database does its job and say what to improveoptional field · a field the user may leave empty, so it has no presence check
Explanation
This lesson is a project: design a small database on paper. First decide the purpose. Second, choose the fields. Keep only the data that is needed, and use invented data only. Third, write the field list with the data type and a validation rule for each field. Fourth, draw the data collection form. Fifth, test it with a test plan that includes normal, boundary and invalid data. Work out the expected outcome of each test before you check it. Sixth, evaluate. Is all the data necessary? Is the data in each field in the same format? Are validation rules set? Say what works and what to improve. The worked example is a seed swap; your own project must have a different purpose.
Step
What you do
1 Purpose
say what the database is for
2 Fields
only the data you need
3 Rules
data type and validation for each field
4 Form
clear, logical, shows formats
5 Test
test plan: normal, boundary, invalid
6 Evaluate
necessary, same format, validated
Worked examples
Field
Data type
Validation rule
Seed ID
automatic number
primary key
Plant name
text
presence check; length at most 20
Packets
number
range check: 1 to 20
Year packed
number
range check: 2020 to 2026
Notes
text
none (the field is optional)
Purpose: a community garden keeps a record of seed packets that members swap. The field list has five fields. The notes field is optional, so it has no presence check.
Type
Test data
Expected
Actual
Pass/fail
normal
Basil, 5 packets, 2025
accepted
accepted
pass
boundary
Basil, 1 packet, 2025
accepted
accepted
pass
boundary
Basil, 20 packets, 2025
accepted
accepted
pass
boundary
Basil, 0 packets, 2025
rejected
rejected
pass
boundary
Basil, 21 packets, 2025
rejected
rejected
pass
boundary
Basil, 5 packets, 2020
accepted
accepted
pass
boundary
Basil, 5 packets, 2019
rejected
rejected
pass
invalid
no plant name, 5 packets, 2025
rejected
rejected
pass
A test plan for the seed database. The expected outcomes were worked out from the rules first. The boundary values for packets are 1, 20, 0 and 21. For the year they are 2020 and 2019. All tests passed.
Question
Answer
Is all the data necessary?
yes, each field is used when swapping seeds
Is the data in the same format?
yes, the year is always four digits and packets are numbers
Are validation rules set?
yes, on every field except the optional notes
What to improve?
add a field for the best month to sow, with a list of months
The evaluation of the seed database. It answers the three evaluation questions, and then suggests an improvement.
Class activity
Your own database project (no computer). Choose a purpose that is not seeds, for example board-game loans in a club, uniforms in a school shop or books in a class library. Write the purpose. List five fields, using only needed data and invented records. Write a field list with a data type and a validation rule for each, including one range check and one length check. Draw a data collection form with instructions and a date format. Make a test plan with at least six tests (normal, boundary and invalid) and work out expected outcomes before checking them. Write four sentences to evaluate it. If you have a computer or tablet, ask an adult to help you type your field list.
Practice
1
A new field “Seeds per packet” has a range check of 10 to 100. Complete the expected outcome column for the values 10, 100 and 9.
Seeds per packet typed
Expected outcome
10
?
100
?
9
?
10 is accepted and 100 is accepted, because they are on the edges of the range. 9 is rejected, because it is just below the lowest allowed value.
2
For the seed database, would the record (Mint, 3, 2027) be accepted? Which rule decides?
Plant name
Packets
Year packed
Mint
3
2027
No. The year 2027 is outside the range 2020 to 2026, so the range check on the year rejects it.
3
A pupil’s database has the field “favourite colour” for a project that only lends books. Explain what is wrong when evaluating the database.
The data is not necessary for the purpose, because the colour does not help with lending books. Extra data takes time to collect and store, so the field should be removed.
4
Write three sentences to evaluate a database in which some dates are written as 5/3/24 and others as 05/03/2024, and no validation rules are set.
The dates are not in the same format, so searches may miss records. No validation rules are set, so wrong or missing data is accepted. To improve it, use one date format with a format check and add presence and range checks where they make sense.