Learning outcomes for this page:
1. Be aware of the incorrect method of attempting
to solve problems with repeating groups
2. Be aware that fields with large numbers of null
values suggest a poor database design
Notice that I set the constraint a single measurement for each visit in the previous example. If I had decided to allow the possibility of recording one or more measures (possibly to check measurement accuracy) at each visit we could have had the situation of a repeating group within a repeating group:
|
Doc id |
Doc name |
Patient name |
Weight |
|
1 |
smith |
Gray Harvey Anderson Smith |
7.5, 7.3, 7.5 9.0, 9.0 10.5, 10.4, 10.7, 10.5 |
|
2 |
Jarvis |
Hewitt |
16.0, 15.8 |
|
3 |
Goodall |
Farmer |
8.0, 7.9, 7.8, 8.0 |
Adopting the same strategy as given in the first example produces the following result (this is not the correct solution!):
|
Doc id |
Doc name |
Patient name (visit1) |
Patient name (visit2) |
|
Patient weight (visit1 reading 1) |
Patient weight (visit1 reading 2) |
|
Patient weigh (visit2 reading 1) |
|
|
1 |
smith |
Gray |
Harvey |
|
7.5 |
7.3 |
|
Smith |
Smith |
Considering the above solution further it should be noted that most databases have something like a maximum number of fields in the region of 250 for each table in contrast there is usually no restriction on the number of records (rows).
The next page offers the correct solutions to the above problems.
For: Clinicians | NHS managers | Non healthcare workers
Written by Robin Beaumont & Chris Noden e-mail:robin@ieg-net.co.uk or chrisnoden@hotmail.com