Databases: tables, fields, records and primary keys Cambridge IGCSE Computer Science revision

Not started

Learn it

In plain words

A database is an organised store of data. The kind in this syllabus is a single table, like a neat grid: one row for every item, and one column for every fact about it.

5 things to know

  1. A table holds the data. A record is one row: all the data about one person or thing. A field is one column: one item of data that is stored for every record.
  2. Each field has a data type: text or alphanumeric, character, Boolean, integer, real, or date/time.
  3. A primary key is a field that uniquely identifies each record. No two records can have the same value in it.
  4. A name is a poor primary key, because two people can share one. An ID number given to each record is the usual choice.
  5. Validation can be applied to fields, so that only sensible data is accepted into the table.

Worked example

A club keeps a table of members with the fields MemberID, Name, DateJoined, Fee and Active. Choose a data type for each, and a primary key.

  1. MemberID, such as M0042: text (alphanumeric). Name: text.
  2. DateJoined: date/time. Fee, such as 12.50: real. Active, yes or no: Boolean.
  3. The primary key is MemberID, because it is the only field that is different for every member.

Tips and tricks

  • To count the fields, count the columns. To count the records, count the rows, leaving out the row of headings.
  • Justify a primary key with the word "unique": it uniquely identifies each record.
6 questions, about 2 minutes.

It lands in your notebook with its questions as flashcards.

Databases: tables, fields, records and primary keys: 6 questions and answers

These are the quiz’s questions. Do the quiz first, then come back here for the ones that got you.

  1. In a database table, what is a record?
    • one column
    • one row: all the data about one item (the answer)
    • the name of the table
    • a type of query

    Each row is a record.

  2. In a database table, what is a field?
    • one column: one item of data stored for every record (the answer)
    • one row
    • the whole table
    • a password

    Each column is a field.

  3. What is a primary key?
    • the first field in the table
    • a field that uniquely identifies each record (the answer)
    • a password for the database
    • the largest value in a field

    No two records share a value in it.

  4. Which field would make the best primary key for a table of students?
    • FirstName
    • DateOfBirth
    • StudentID (the answer)
    • FormGroup

    It is the only one certain to be different for every student.

  5. Which data type suits a field that records whether a book is on loan?
    • real
    • text
    • Boolean (the answer)
    • date/time

    It has two possible values: yes or no.

  6. A table has 6 columns and 40 rows of data. How many records does it hold?
    • 6
    • 40 (the answer)
    • 46
    • 240

    One record for each row of data.

Still stuck on this one?Ask in the Papermunch Discord, or help someone else who is. Discord is for ages 13 and up.Join the server

Things you can type

Or go straight to

Or browse a shelf