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
3

Build and update a table

Computing 6: Unit 7, pp. 92–105
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 codeKite nameWingspan (cm)First flightFlights today
K-1Blue Wave904 May3
K-2Red Fox1209 May2
K-3Blue Wave1401 June4
K-4Gold Star1103 June1
K-5Green Leaf15012 June5
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.
UpdateRecords beforeRecords after
add K-656
change K-3 wingspan66
delete K-465
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 codeTool nameSize
T-04hammersmall
T-07sawmedium
T-11hammersmall
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 codeTeam namePoints
T-1Hawks8
T-2Foxes12
T-3Bees10
T-4Lions6
T-5Eagles4
T-6Wolves9
3
A person types the word ‘twelve’ into a field that holds numbers. What should the database do, and why is that useful?
4
Plan a one-table database for a class library helper rota. Write the field names and data types.