GoalBuild a single-table database in a spreadsheet with a unique code, and add, change and delete records.
New words
unique · different in every recordupdate · to add, change or delete data in a databasecode · a short label, such as K-3, that identifies one recordaccurate · correct and free from mistakes
Explanation
Two records can hold the same data. A festival may have two kites called Blue Wave. We need a field that is different in every record, and a code does this job. It tells the records apart. To build the table in a spreadsheet, type the field names in the first row. Set the data type of each column with data validation. Then type each record on its own row, with no empty rows between them. To update the database we can add a record at the bottom, change a value in a cell or delete a whole row. We check each change. A database is only useful if the data in it is accurate.
Kite code
Kite name
Wingspan (cm)
First flight
Flights today
K-1
Blue Wave
90
4 May
3
K-2
Red Fox
120
9 May
2
K-3
Blue Wave
140
1 June
4
K-4
Gold Star
110
3 June
1
K-5
Green Leaf
150
12 June
5
Worked examples
Two kites are called Blue Wave, one with a wingspan of 90 cm and one with 140 cm. If the pilot asks about ‘Blue Wave’, which kite is meant? The code answers it, because each code is used only once: K-1 is the 90 cm kite and K-3 is the 140 cm kite.
Update
Records before
Records after
add K-6
5
6
change K-3 wingspan
6
6
delete K-4
6
5
Here are three updates. Add the new kite K-6, Pink Sky, wingspan 100, first flight 15 June, 0 flights, on a new row at the bottom. Correct K-3’s wingspan from 140 to 150 by editing one cell. Delete K-4, because it was damaged and has been withdrawn, by removing its whole row. The table had 5 records, then 6 after the add, then 5 after the delete.
With data validation on the Wingspan column, typing ‘big’ in a cell shows a warning and the cell is not changed. Rules like this keep mistakes out of the database.
Class activity
Card database (no computer): use your six shell cards, or make six cards for your own collection. Add a code in the corner of each card, such as S-1 to S-6. Now update the database. Add a new card at the end with the next code. Change one field on one card and cross out the old data neatly. Remove one card. Count the cards after each change. Then put the cards in order of their codes. If you have a computer or tablet, build the table in a spreadsheet and try the three updates.
Practice
1
A tool library has two hammers. How can the library tell which one was borrowed?
Tool code
Tool name
Size
T-04
hammer
small
T-07
saw
medium
T-11
hammer
small
The codes are different: T-04 and T-11. The code is unique, so the record of the borrowed hammer can be found even though the names are the same.
2
The quiz table needs three updates: add T-7 Owls with 0 points, change the points of T-2 from 12 to 15 and delete T-5. Write the table afterwards.
Team code
Team name
Points
T-1
Hawks
8
T-2
Foxes
12
T-3
Bees
10
T-4
Lions
6
T-5
Eagles
4
T-6
Wolves
9
After the updates: T-1 Hawks 8; T-2 Foxes 15; T-3 Bees 10; T-4 Lions 6; T-6 Wolves 9; T-7 Owls 0. There are 6 records.
3
A person types the word ‘twelve’ into a field that holds numbers. What should the database do, and why is that useful?
It should reject the entry and show a warning. This keeps the data accurate, because a number field must hold numbers that can be added and compared.
4
Plan a one-table database for a class library helper rota. Write the field names and data types.
For example: Helper code (text), First name (text), Day of duty (text), Date of first duty (date), Number of duties (number).