Revise Computingrevisecomputing.co.uk
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates
At a glanceFeaturesStudentsPricingHow it worksFree GCSE notesExam dates

Knowledge organisers / Additional Programming Techniques

The use of records to store data

All topicsPractise exam questions
Knowledge organiser

Additional Programming Techniques

2.2.3d

Use of 2D arrays to emulate database tables of a collection of fields, and records

What you need to know

A record is a data structure used to group related data of different types under one structure, similar to a row in a database table. Each piece of data in a record is called a field, and fields can have different data types (e.g. string, integer, Boolean). In Python, records can be represented using dictionaries or classes.

Key points

  • Definition:Data Structure: a method of organising and storing data so that it can be accessed and used efficiently. Examples include arrays, records, and 2D arrays.
  • Definition:Record: a data structure that can hold multiple pieces of data of varying data types, grouped together as a single entity.
  • Each item in a record is called a field and can be a different data type.
  • Records are similar to a single row in a database table.
  • Example: a student record might have fields for name (string), age (integer), and enrolled (Boolean).
  • In Python, dictionaries or classes can be used to represent records.
  • 2D arrays can also emulate a collection of records (a table of fields and records).

Code examples

Record using a dictionary
python
# A record as a dictionary
student = {
    "name": "Alice",
    "age": 16,
    "enrolled": True
}

print(student["name"])   # Output: Alice
print(student["age"])    # Output: 16