GoalPlan a single-table database by choosing its purpose, its data, its records and its fields.
New words
database · an organised store of data that is easy to search, update and sorttable · data arranged in rows and columnsrecord · one row of a table, holding all the data about one thingfield · one column of a table, holding one kind of data about every record
Explanation
A database stores data so that it is easy to find, change and sort. A simple database has one table. Before we build it we plan it with four questions. What is the purpose of the database? Which data does it need? How will the data be organised? What will the column headings be? In a table, each row is a record and holds everything about one thing. Each column is a field and holds one kind of data. The data we planned become the fields. We store only the data that we really need. We do not keep private details such as home addresses unless there is a good reason, and we ask an adult first.
Planning question
Our answer for the seed box
What is the purpose?
to know which seed packets the garden club has
Which data do we need?
a code, the plant name, the month to sow and the packets left
How is it organised?
one record for each kind of seed, 6 kinds, so 6 records
What are the headings?
Seed code, Plant name, Month to sow, Packets left
Worked examples
Seed code
Plant name
Month to sow
Packets left
S-01
sunflower
April
4
S-02
pea
March
7
S-03
carrot
May
3
S-04
marigold
April
9
S-05
bean
May
5
S-06
radish
March
6
This is the table that comes from the plan. It has 6 records (rows) and 4 fields (columns). The first row holds the field names, and it is not a record.
A good plan uses short, clear field names. ‘Packets left’ is better than ‘How many seed packets are still in the box’. It also keeps each field to one kind of data. A field called ‘Plant and month’ would put two things in one column, and that would make searching harder.
The garden club could also ask for each member’s home address, but the database is only about seeds. The purpose tells us what to leave out. Personal details should not be stored unless they are needed.
Class activity
Shell collection (no computer): choose a collection, such as shells, stamps, stickers or football cards. Write the purpose of a database for it, then list the data that you need. Choose four field names. Make six index cards, one for each item, and write the four headings on each card. Fill them in. Each card is a record, and each heading is a field. Put the cards in a row like a table. If you have a computer or tablet, type the headings in the first row of a spreadsheet and the cards in the rows below.
Practice
1
A sports club wants a database of the balls and bats in its cupboard. Write the purpose, four fields that the database needs and how many records there are if the cupboard has 9 items.
Purpose: to know what equipment the club has. Fields for example: Item code, Item name, Number in cupboard, Date bought. There are 9 records, one for each item (or one for each kind of item).
2
How many records and how many fields does this table have?
Tree code
Tree type
Height (m)
A-1
oak
12
A-2
pine
9
A-3
plane
15
A-4
cedar
11
There are 4 records and 3 fields. The row of headings is not a record.
3
A database is planned for a library helper rota. Which of these should it store? Helper’s first name, day of duty, home address, favourite food.
The first name and the day of duty. The home address is private and the rota does not need it, and favourite food is not part of the purpose.
4
Choose the better field name in each pair and say why. (a) ‘Thing’ or ‘Plant name’. (b) ‘Packets left’ or ‘How many packets of seeds are left in the big box’.
Pair
First choice
Second choice
(a)
Thing
Plant name
(b)
Packets left
How many packets of seeds are left in the big box
(a) Plant name, because it tells us what the data is. (b) Packets left, because it is short and clear.