An organised set of data is usually referred to as a database.

Databases can be a little difficult to understand, so I'll try to illustrate the concept with a few diagrams.

We will use some student data as an example.

Here are our students...
Databases can be found at the heart of almost every computer system:
  • Databases of users
  • Databases of files
  • Databases of webpages
  • Databases of blog entries
  • Databases of photos
  • Databases of products
Databases are everywhere!
Stacks Image 3541
ID No.: 356
Name: Jess
D.o.B.: 3 Mar 1995
Phone: 7564356
Class: 5B
Tutor: Mr Noggin
Room: 56
ID No.: 412
Name: Hamad
D.o.B.: 12 Nov 1994
Phone: 7465846
Class: 5B
Tutor: Mr Noggin
Room: 56
ID No.: 459
Name: Sita
D.o.B.: 9 Jan 1994
Phone: 8565634
Class: 6Y
Tutor: Ms Take
Room: 18
ID No.: 502
Name: Hamad
D.o.B.: 3 Mar 1995
Phone: 6554546
Class: 5B
Tutor: Mr Noggin
Room: 56
You'll see that each student has some data associated with them (name, d.o.b., etc.) We want to store this data is an organised way so that we can easily access it in the future. We want to create a student database.

So, how should we organise this data?

What is a Record?

The set of data associated with a single object or person is known as a record.

In the example of our students, the data associated with each student is a record.

Here is Jess's record...
Stacks Image 3584
Each student has their own record just like Jess's but with different data.

The data in each record is different, but each record has the same structure. (each one has a name, d.o.b., phone, etc.)

We say that each record contains the same fields.
A database is a collection of records.

You can imagine a single record being a card with one the details of one person/object written on it.

A database would be a boxful of these record cards...
Stacks Image 3593
This is exactly how a lot of old, manual databases used to look. If you went to a public library 30 years ago, and you wanted to find a specific book, you would have to look through boxes of index cards until you found the details of your book.

What is a Field, and What is a Field Name?

You'll see that each of our student's records contain the same items. These items are known as fields.

Each field has a field name (e.g. 'Date of Birth')

Each field will contain different data in each of the records (e.g. in Jess's record, the Phone field contains 7564356, but in Sita's record the Phone field contains 8565634 - same field, different data values)

It can be a bit confusing - what's the difference between the field, the field name, and the data in the field?!

Imagine that you were manually filling in a record card for Jess. The card would have various labels and boxes to write in...
Stacks Image 3608
  • The field is the box that you would write in
  • The field name is the label next to the box
  • The data is what you would write in the box
Each of our student records contains seven fields:
  • ID Number
  • Name
  • Date of Birth
  • Phone Number
  • Class
  • Tutor
  • Room

What is a Key Field / Primary Key?

It is very important that every record in a database can be individually identified. We need to be sure that when we access a record, we are accessing the correct one.

Take a look at our students - what item of data identifies them from all of the other students?
  • Name? No - we have two Hamads
  • Date of Birth? No - Jess and Hamad share the same birthday
  • Phone? No - two or more students may live at the same address
  • Class / Tutor / Room? No - each class has many students
Because all of these fields might contain the same data for more than one record, we can't use them to identify each record.

So... we have given each student an ID number. We can guarantee that this number will be unique for every student.

The ID number is the ideal field to use to uniquely identify each individual record. We call this field the Key Field, or Primary Key.
Stacks Image 3627
It is usual for a code or ID number to be used as the key field.

In the example, we could have used the student name as the key field, but this would be a bad idea.

Why? Because two or more students might have the same name, so the name would not identify each student uniquely.

Database Viewed as a Table

It is quite common to view the contents of a database as a table instead of one record at a time. A tabular view is compact and allows you to see a lot of records in one go.

Our student database would look like this...
The tabular view of a database is is exactly the view that you see when working with your database software (e.g. Microsoft Access).
Stacks Image 3646
Each row of the table corresponds to a database record...
Stacks Image 3652
The column headings correspond to the database field names...
Stacks Image 3658
Each cell of the table corresponds to a field, and contains an item of data...
Stacks Image 3664

Sorry to ask you this, but...


This site took quite a bit of time and effort to create, and it costs me money to keep it up and running. If the site has helped you, please consider showing your appreciation by donating a little towards the site's running costs.

Thank you!

Sponsored Links...