Learning outcomes:
1. Be able to describe what a composite
key is.
2. Be able to recognise composite keys.
So far we have used tables where each record has a unique identifier based upon a single field e.g. 'patient id', 'doctor id' etc. However sometimes a table has what is known as a 'composite key'. In this instance the uniqueness of each record is determined by the combined values in more than one field. As an example consider you work at a GUM clinic where anonymity is often required. In this instance patients are given a card which contains a number and their date of birth. At the beginning of each year the card number starts again at '1'. Therefore to uniquely identify a clients records it is necessary to have a table with a composite key made up from the year and number fields. It is the combination that must be unique for each record.
Gum clinic record with a composite key
|
year |
number |
… |
…… |
|
1996 |
1 |
… |
… |
|
1996 |
2 |
…. |
….. |
|
1996 |
3 |
…. |
… |
|
… |
….. |
….. |
…… |
|
1997 |
1 |
…. |
…… |
We will make use of composite keys during the process of normalisation.
For: Clinicians | NHS managers | Non healthcare workers
Written by Robin Beaumont & Chris Noden e-mail:robin@ieg-net.co.uk or chrisnoden@hotmail.com