AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Year plan · Computing

Design a table

Week 16 · Unit 7: Be a data architect · 3 lessons
1

Plan a database

Computing 6: Unit 7, pp. 92–105
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 questionOur 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 codePlant nameMonth to sowPackets left
S-01sunflowerApril4
S-02peaMarch7
S-03carrotMay3
S-04marigoldApril9
S-05beanMay5
S-06radishMarch6
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.
2
How many records and how many fields does this table have?
Tree codeTree typeHeight (m)
A-1oak12
A-2pine9
A-3plane15
A-4cedar11
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.
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’.
PairFirst choiceSecond choice
(a)ThingPlant name
(b)Packets leftHow many packets of seeds are left in the big box