Relational Databases - An Example

As an example we will create a standalone database using Base program. To show the principles, lets create a database of the nutritional information on UK food packets.

Most food packaging,in the UK, has a label like this, there are two columns. On column is usually per 100g the other may be per packet or per serving or many other options.

First we will construct a single table database, we will then 'normalise' this database by creating linked tables to remove the need for duplicate information.

The first, single table, database will contain the following fields:

  • type - this has some categories for types of foods
  • description - this has information about the product such as brandname
  • barcode - this is the barcode number printed on the packet.
  • energykj - this is a numeric value in kJ
  • energykc - this is a numeric value in kcal
  • protein - this is a numeric value in g
  • carb - this is a numeric value in g
  • sugar - this is a numeric value in g
  • fat - this is a numeric value in g
  • saturates - this is a numeric value in g
  • fibre - this is a numeric value in g
  • sodium - this is a numeric value in g
  • hydrodised - this applies to the whole product and has values 'yes', 'no', 'don't know' or empty.
box label

Some initial possible values of type are:

In this initial version of the database, to enter the information from the above pack we would have to enter two records, one for per 40g serving and another per 100g. This means that the values for: type, description, barcode and hydrodised will be duplicated, we will remove this duplication later when we normalise the data.

Next step - goto Importing data further steps:


metadata block
see also:



Correspondence about this page

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.