Relational Databases

Computer Science: OCR A Level, topic 3.2.3

Relational Database

A relational database is a set of tables whose records are linked by certain fields.

Relational database

Relational database

  • A relational database is a set of tables whose records are linked by certain fields.
  • Each table contains data on one entity e.g. students or parents.
  • When you link one table to another, this is known as a relationship.
  • Each table then has a relationship to other tables using primary and foreign keys.
Foreign key

Foreign key

  • If the primary key of one table is placed into another table, this is then known as a foreign key.
  • For example, when a student ID field is added to a parent table to link you to your parents accounts, that student ID is a primary key in the student table but becomes a foreign key in the family table.
  • The parents table will have its own primary key.
Secondary key

Secondary key

  • A secondary key may also be kept by the database.
  • A parent may not know their child’s student ID, but they will be able to locate their last name in the database.
  • Secondary keys do not need to be unique.

Test yourself on Relational Databases

  • What do we call the primary key of one table when it is placed into another table?

  • A venue uses a relational database to keep track of bookings.
    What is the primary key of the bookings table?

  • A venue uses a relational database to keep track of bookings.
    What is the primary key of the members table?

Practise this topic for free