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

Right data, right format

Week 19 · 2.2 Data and databases · 3 lessons
2

Same format, better search

Computing 8: Topic 2.2, pp. 212–229
GoalUse the words record, field and primary key, and explain why data in a field needs one format.
New words
record · all the data about one thing or person: one row of a tablefield · one kind of data about every record: one column of a tableprimary key · a field whose value is different for every record, so each record can be found exactlyformat · the way data is written, such as DD/MM/YYYY for a date
Explanation

A database stores data in a table. Each row is a record, which holds all the data about one member. Each column is a field, which holds one kind of data about every record, such as the date joined. A primary key is a field where every record has a different value, such as a member number. Names are not good keys, because two members can have the same name. To search correctly, all the data in a field must use the same format. Suppose one member joined on 5 March 2024. If some records say 05/03/2024, others say 5 March 2024 and others 05.03.24, a search for one form misses the rest. A date format such as DD/MM/YYYY means day, month, then the year with four digits.

Member IDMemberJoined
M01Lena Park05/03/2024
M02Omar Said05/03/2024
M03Ravi Das05/03/2024
Worked examples
MemberJoined
Lena Park05/03/2024
Omar Said5 March 2024
Ravi Das05.03.24
Mia Cruz05/03/2024
Tom ReidMarch 5th 2024
A garden club’s member table. Every member joined on the same day, but the dates are written in different ways. Each row is a record, and the Joined column is a field.
Search forRecords found
05/03/2024Lena Park, Mia Cruz
5 March 2024Omar Said
05.03.24Ravi Das
March 5th 2024Tom Reid
A search for 05/03/2024. Only two records match, even though all five members joined that day. The other dates mean the same day, but the computer compares the characters, not the meaning.
MemberJoined
Lena Park05/03/2024
Omar Said05/03/2024
Ravi Das05/03/2024
Mia Cruz05/03/2024
Tom Reid05/03/2024
With one format for the whole field, DD/MM/YYYY, the same search finds all five members. Another problem remains: 03/05/2024 could mean 3 May or 5 March, so everyone must know which format is used.
Class activity

Date detectives (no computer). Write ten join dates for an imaginary club on small cards, using four different styles, such as 12/04/2025, 12 April 2025, 12.04.25 and April 12th 2025. Mix the cards. Your partner sorts them into piles that mean the same date. Then rewrite every card in DD/MM/YYYY. Now “search” the original cards for the exact text 12/04/2025 and count how many you find, and then search the rewritten cards. Explain what the numbers show. If you have a computer or tablet, ask an adult to help you type your cards into a table.

Practice
1
In the table, name the records, the fields and say which field would make a good primary key.
Member IDMemberJoined
M01Lena Park05/03/2024
M02Sam Lee09/04/2024
M03Sam Lee14/05/2024
2
Write these dates in the format DD/MM/YYYY: 3 June 2025; 14.08.25; December 2nd 2024.
3
A teacher searches the table for 12/10/2025 and finds only 2 of 4 pupils who joined that day. Explain why.
PupilJoined
Ana12/10/2025
Ben12 October 2025
Chen12/10/2025
Dina12.10.25
4
Why is a member’s name not a good primary key?