HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
Database Tables, Data Types and Primary Keys
  1. 1Tables, fields and records
  2. 2Data types and the primary key
  3. 3Validation in a database table
  1. Computer Science
  2. /Database Tables, Data Types and Primary Keys
  3. /Tables, fields and records

Course 9.1·Lesson 1 of 3

Tables, fields and records

A database table stores data about many things of one kind, such as the members of a club. Each row is a record and each column is a field. You learn these words, count records and fields, and define a single-table database from a list of what has to be stored.

about 25 min1 simulation1 practice question
Lesson 1 of 3Show all lessonsHide
Database Tables, Data Types and Primary Keys
  1. 1Tables, fields and records
  2. 2Data types and the primary key
  3. 3Validation in a database table

Try the code and the simulations beside the lesson.

A list you already know

Think of the register your teacher keeps. There is one line for each student. Along the top are headings such as the first name, the surname and the date of birth. Every line has the same headings.

A database is a store of data kept in this kind of order, so that a computer can search it, sort it and add things up. The IGCSE course uses a single-table database: all the data sits in one table.

Tables, records and fields

Look at this table from a sports club. Its name is Members.

table
MemberID  FirstName  Surname  Town       Age  Paid
M01       Asha       Patel    Riverside  15   TRUE
M02       Tom        Okafor   Hillview   14   FALSE
M03       Lena       Novak    Riverside  16   TRUE
M04       Ravi       Patel    Lakeside   15   TRUE
M05       Mei        Chen     Hillview   13   FALSE
The Members table drawn as a grid with 6 columns and 5 rows of data under a row of headings. The headings are MemberID, FirstName, Surname, Town, Age and Paid. The second row of data, M02, Tom, Okafor, Hillview, 14, FALSE, is shaded and labelled 'a record (one row)'. The Town column is shaded and labelled 'a field (one column)'. The heading Surname is labelled 'a field name'. The MemberID column is labelled 'primary key'.
  • A table holds data about one kind of thing. Here every row is about one club member.
  • A record is one row. It holds all the data about one member. The table has 555 records.
  • A field is one column. It holds one item of data for every record, such as the town. The table has 666 fields.
  • A field name is the heading of a field, such as Surname. Field names are not records.

So one record is all about one member, and one field is one detail about every member. Ask yourself: is the line of headings a record? No. It only names the fields.

Each box of the table holds one data item. The table holds 5×6=305 \times 6 = 305×6=30 data items.

Defining a table from what must be stored

An examination question often describes what a business wants to store. You then define the table. Let us do one together.

A vet wants to store, for each pet: its name, the kind of animal, the owner's phone number, the date of its last visit and whether it has had its injections.

  1. One record for each thing. Each pet gets one record.
  2. One field for each item of data. That gives PetName, Animal, OwnerPhone, LastVisit and Vaccinated.
  3. A field that tells the records apart. Two pets can have the same name, so we add PetID. The next lesson calls this the primary key.
  4. Simple field names. A field name has no spaces, so we write OwnerPhone, not Owner Phone.

Keep one item of data in each field. If a whole name is in one field, you cannot sort by surname. So a person's name is usually split into FirstName and Surname.

Practise with new numbers

Try it in Python

Python has a small database inside it, called sqlite3. The program builds the Members table in the computer's memory. It puts in all five records at once with executemany, then prints every record and counts the records and the fields.

Read it first. Then run it. Does it count 5 records and 6 fields?

1. Add a sixth member, ("M06", "Sam", "Reed", "Lakeside", 14, True), to the list. Predict the two counts, then run it.

2. Look at the Paid field in the output. SQLite stores TRUE as 1 and FALSE as 0.

Common mistakes

  • Mixing up a record and a field. A record is a row about one thing. A field is a column with one detail of every thing.
  • Counting the headings as a record. The line of field names is not data.
  • Two items in one field. A field such as FullAddress cannot be sorted or searched by town. Store the town in its own field.
  • Spaces in field names. Write DateOfBirth, not Date of birth.

Remember these

  • A single-table database keeps all its data in one table.
  • A record is one row: all the data about one thing.
  • A field is one column: one item of data about every thing. Its heading is the field name.
  • To define a table, give one record to each thing and one field to each item of data.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. In the Members table, what does the third record hold?
  1. How many data items are in the Town field of the Members table?
  1. A café wants to store each cake's name, its price and whether it contains nuts. How many fields does the table need if a code field is added to tell the cakes apart?
  1. Why is a single field FullName a poor choice for a list of students?
  1. A table has 121212 records and 444 fields. How many data items does it hold?

References

  • Cambridge International, IGCSE Computer Science 0478 syllabus (exams in 2026, 2027 and 2028), section 9 Databases, 9.1: define a single-table database from given data storage requirements (fields, records).

Enroll free in Database Tables, Data Types and Primary Keys

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (3)

A school library keeps its books in a table called Books…Easy · High School (9–10) · by StemPy Lab
A cinema wants a single-table database of its films…Medium · High School (9–10) · by StemPy Lab
A delivery company has a table Customers with the fields CustomerID, FullName and Address…Medium · High School (9–10) · by StemPy Lab
Next: lesson 2Data types and the primary key
← Database Tables, Data Types and Primary Keys
← PreviousData types and the primary key →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.