☰ Year plan · Communication Technology

Data tables: rows, columns and keys

Week 12 · Lesson 8 Database Design (2) · 3 lessons
1

Tables: rows are records, columns are fields

ICT Prep 1 Term 1, Lesson 8: pp. 77–85
GoalExplain what a data table is and tell rows from columns, records from fields.
New words
data table · the place where a database keeps its data, made of rows and columnsrecord (row) · one row of a table: all the data about one thingfield (column) · one column of a table: one kind of data about every recordcell · the box where one row and one column meet
Explanation

A data table is the basic building block of a database. It is the only place inside the database where the data is kept. A table is made of rows and columns. Each row is one record: it holds all the data about one thing, for example one pupil. Each column is one field: it holds one kind of data about every record, for example the name or one subject’s mark. The box where a row and a column meet is a cell, and it holds one single value. Look at the table of marks below. It is a table called “Student results”, and its numbers are invented, with marks out of 20. It has five fields (id, name and three marks) and five records, one for each pupil. To find Pupil 3’s English mark, find the row of Pupil 3, then follow it to the English column: the cell says 12.

ABCDE
1idNameArabicEnglishComputer
21Pupil 1181519
32Pupil 2141716
43Pupil 3201218
54Pupil 4161915
65Pupil 5121420
Worked examples
ABCDE
1idNameArabicEnglishComputer
21Pupil 1181519
32Pupil 2141716
43Pupil 3201218
54Pupil 4161915
65Pupil 5121420
Count the records in the table of marks. Each pupil is one row, so there are 5 records. Count the fields: id, name, Arabic, English and Computer, so there are 5 fields.
ABCDE
1idNameArabicEnglishComputer
21Pupil 1181519
32Pupil 2141716
43Pupil 3201218
54Pupil 4161915
65Pupil 5121420
Pupil 2 got 14 in Arabic, 17 in English and 16 in Computer. Add the cells of that record: 14 + 17 + 16 = 47. The sum belongs to one record, so we read along one row.
ABCDE
1idNameArabicEnglishComputer
21Pupil 1181519
32Pupil 2141716
43Pupil 3201218
54Pupil 4161915
65Pupil 5121420
Which pupil got the highest mark in Computer? Look down one field, the Computer column, and compare its cells: 19, 16, 18, 15, 20. The highest is 20, in the record of Pupil 5.
Class activity

Make a table on paper for six invented classmates with the fields “id”, “name” and “favourite subject”. Draw the grid with a ruler. Colour one record in yellow and one field in blue. Ask a partner: How many records? How many fields? What is in the cell where row 3 meets the third column?

Practice
1
In a table, what is a record and what is a field?
2
In the table of marks, which mark did Pupil 4 get in English?
3
What is the sum of Pupil 3’s three marks?
4
Where does a database keep its data?