Section 1 Teacher/Lecturer Notes Student’s Notes

advertisement
CONTENTS
Section 1
Teacher/Lecturer Notes
Section 2
Student’s Notes
Section 3
Study Materials
Information Systems: Database Systems (H)
1
Information Systems: Database Systems (H)
2
Section 1
Teacher/Lecturer Notes
Information Systems: Database Systems (H)
3
Information Systems: Database Systems (H)
4
Aim
This unit is designed to develop a knowledge and understanding of data analysis and
structuring techniques and to provide an opportunity to apply this knowledge through
the use of contemporary database software.
Status of this learning and teaching pack
These materials are for guidance only. The mandatory content of this unit is detailed
in the unit specification of the Arrangements document.
Target audience
While entry is at the discretion of the centre, students would normally be expected to
have attained one of the following (or possess equivalent experience):
 Database Systems (Int 2) unit
 Information Systems course at Intermediate 2 level
 Standard Grade in Computing Studies (Grade 1 or 2).
Progression
This unit builds on skills acquired particularly at Intermediate 2 (or Standard Grade)
level in database work, but emphasises the design of database structures. It links
closely with Information Organisation (H) and gives useful insights and skills in
preparation for the Advanced Higher units DATABASE SYSTEMS and
INFORMATION SYSTEMS PROJECT.
Hardware and software resources
A relational database is required for this unit (more details on page 6). You should
remember that Outcomes 1 and 2 do not require computer work, and that the time
allocation recommended for Outcome 3 is one-quarter of the total. This means a
‘hands-on’ requirement of ten hours.
Learning and teaching approaches
You should note that Outcomes 1 and 2 represent a new approach to the teaching of
database systems familiar from Standard Grade and even Intermediate 2. The
emphasis now is on the analysis of an existing system (non-computerised) and the
design of a corresponding database structure which is then implemented in Outcome
3. The differences between the two systems and the advantages of computerisation
should be stressed throughout the course.
The time allocation of computer-based work, ten hours, has implications. Students of
computing tend to expect plenty of ‘hands-on’ activity, and may be disappointed.
However, to compensate, an extra section ‘Software Familiarisation’ has been added
at the end of Outcome 1. You, as teacher/lecturer, must ensure that activities are
varied and inventive: group work, discussions and topical scenarios will all help. The
usual method adopted throughout the first two outcomes has been to create suitable
scenarios, which the student must analyse. By ‘suitable’ is meant ‘modern, topical,
up-to-date, and relevant to the student’s interests and tastes’.
The pack is divided into sections and the outcomes are in numerical order.
Information Systems: Database Systems (H)
5
The Performance criteria for each outcome are normally covered in the order stated in
the Arrangements. Any deviation from this is highlighted at the top of each section.
Pathway through the unit
The concepts, terms and skills covered in a section are listed at the top of the student’s
notes for that section. They are not, therefore, repeated here.
The suggested number of hours for each section includes time for an introduction to
the topic, discussion and exemplification of concepts, use of computers and other
resources and, where appropriate, assessment.
Title of the Section
Outcome 1
Software Familiarisation
Outcome 2
Outcome 3
Hours
10
5
10
10
Assessed
Yes
No
Yes
Yes
Software and hardware
The recommended software is a relational database package called Easy Base, and all
practical exercises are based on it. This can be downloaded for approval via the
Internet at: http://ourworld.compuserve.com/homepages/easysoftware. Full details
can be obtained from internal documentation in the demo version, which is fully
operational, or from:
Easy Software Ltd.
3 Brookside Court
Prestbury Road
Macclesfield
SK10 3BR.
(Sample prices: £35 for Single User copy, and £60 for Network)
System requirements
Easy Base is a DOS package, and runs on all platforms. It requires an IBM or
compatible PC 286 or higher with 1 megabyte of RAM and 540K free conventional
memory (570K in network version). This is minimum, and the preferred specification
is 4 megabytes of expanded memory with 2 megabytes allocated to PC-cache.
References
Books
The following books may be of use as a general introduction to the topic:
Date, C.J. 1995. An Introduction to Database Systems. Addison-Wesley. (£26, but a
most valuable resource for Higher and Advanced Higher)
Jaworski, Barbara and John. 1982. Computers; Information and Data. Nelson.
Shelley, John and Hunt, Roger. 1982. Computer Studies: A First Course. Pitman.
Taylor, G. 1986. Work Out Computer Studies. Macmillan.
Wright, G.G.L. 1985. Mastering Computers. Macmillan.
Information Systems: Database Systems (H)
6
Terminology conforms to the British Computer Society’s Glossary of Computing
Terms, (eighth edition) published by Longman, price £9.99.
Internet
A wide range of articles on the Internet is available by typing “Database Systems” on
your search engine. There are many commercial and academic sites, of which the
following are a selection:
http://www.dingo.com/kesoft/texrdbms.html
http://www.ke.com.au/ke/products/texql.html
http://www.nku.edu/%7Eraghavan/ASSIGN1.htm
(to save time with these, simply type part of the URL, e.g. ‘texrdbms’.
Information Systems: Database Systems (H)
7
Information Systems: Database Systems (H)
8
Section 2
Student’s Notes
Information Systems: Database Systems (H)
9
Information Systems: Database Systems (H)
10
This unit, Database Systems, is a compulsory part of Information Systems (Higher).
You will find it easier if you have already studied Database Systems either at Standard
Grade or Intermediate 2. However, there is an important difference in Database
Systems at Higher grade. This can be explained by looking at the outcomes, which are
as follows:
1. Construct a data model of an existing, non-computerised system;
2. Design database structures to represent the data model;
3. Implement a designed database system.
The data model in Outcome 1 is to be normalised, that is stripped of unnecessary data
items.
You can see from this that computer work is required for Outcome 3 only. Outcomes
1 and 2 are about analysis and design, and you will be spending three-quarters of your
time on them (recommended). If you have done Database Systems at Intermediate 2
or Standard Grade, you will find the work for Outcome 3 straightforward. But
Outcomes 1 and 2 may be unfamiliar.
How to tackle this unit
A standard learning pattern is suggested for your use throughout this unit:
 clear outline of the main learning points
 practical tasks or problem solving exercises to help you explore these points
 questions to check understanding of these points
 a summary of the points for future learning and assessment purposes.
Assessment
Assessment will normally follow each unit, but your teacher or lecturer may insert
additional items at regular intervals. Possible end-of-unit items are as follows:
Outcome 1
Assignment involving an analysis leading to the production of a data model.
Outcome 2
Assignment involving the design of a database corresponding to the data model.
Outcome 3
Practical exercise involving the implementation of the designed data structures.
Information Systems: Database Systems (H)
11
Resources
Books
The following books may be of use as a general introduction to the topic:
Date, C.J. 1995. An Introduction to Database Systems. Addison-Wesley.
Jaworski, Barbara and John. 1982. Computers; Information and Data. Nelson.
Shelley, John and Hunt, Roger. 1982. Computer Studies: A First Course. Pitman.
Taylor, G. 1986. Work Out Computer Studies. Macmillan.
Wright, G.G.L. 1985. Mastering Computers. Macmillan.
Internet
A wide range of articles on the Internet is available by typing “Database Systems” on
your search engine. There are many commercial and academic sites, of which the
following are a selection:
http://www.dingo.com/kesoft/texrdbms.html
http://www.ke.com.au/ke/products/texql.html
http://www.nku.edu/%7Eraghavan/ASSIGN1.htm
(to save time with these, simply type part of the URL, e.g. ‘texrdbms’.
Information Systems: Database Systems (H)
12
Section 3
Study Materials
Information Systems: Database Systems (H)
13
Information & data
Data is the raw (electronic) material that can be processed by a computer. It takes
the form of words, numbers or symbols which must be in a special format, often in
code, while being manipulated (handled or processed) by the computer.
Information is meaningful data with structure, that is, it has been organised into a
form which human beings can understand; normally it is relevant, accurate, up-to-date
and can be used to take actions or make decisions.
Data also needs context to be converted into information, that is, the situation or
environment in which it appears. Consider, for example the numbers 290296. Is it a
telephone number, or a date of birth perhaps? Would it be more meaningful written as
290 296, or as 29 02 96? In its context, it is only a date if 1996 is a leap year (it is).
Supposing that a date was written with five digits, as in 21195. Is this now Jan 21st
1995, or is it Nov 2nd 1995? This could be solved by having a six digit number with a
separator, either a slash / or a space. This would be better for human beings
(information), but not for a computer (data). But it would have to be told that a range
check for the day (1-28, 1-29, 1-30 or 1-31), month (1-12), and year (1-99) was
necessary.
There is another problem with dates of birth which is entirely contextual. To an
American, the date 10/12/98 means not Dec 10th but Oct 12th, because the American
system requires the month to come first. So we could say that one piece of data can
represent many pieces of information.
Task 1 (for groupwork)
1.1 In groups of four, imagine that you are the subject of a survey about teenagers, and
write down the kinds of information you would like to include. Do this before you
discuss anything. Appoint a chairperson who makes the following announcement:
‘We are going to make a survey about teenagers’ preferred tastes in music, films,
TV programmes, sports, newspapers and political parties. Write down without any
discussion what sort of things you think should be included.’
1.2 You should have twenty or thirty pieces of information to be collected by the
chairperson, or scribe, if the chairperson decides, quite properly, to delegate. The
fact that no discussion was allowed will have presented a problem. Some people,
for example, will have written down items such as ‘name’, ‘address’, ‘age’, while
others will have written ‘Willy’, ‘Glasgow’, ‘Oasis’. Both of these are correct - you
simply weren’t given enough information.
1.3 Next the chairperson should ask the group to decide which items are to be used,
not examples of them yet. These items or types of information are called fields more about them later.
1.4 Next to be decided is the format of these items. For example, if one of them is date
of birth, how is that to be set down? This is called standardisation: it means,
setting a common or standard format. Another example would be ‘name’ - should
it be in the form ‘Frances Smyth’, ‘F. Smyth’, ‘Smyth, Frances’, or ‘Smyth, F.’?
Or should the surname be separate from the christian name? What about the vexed
Information Systems: Database Systems (H)
14
question of ‘Miss’, ‘Ms’, or ‘Mrs’ for females? It doesn’t matter which version
you choose, as long as it is used consistently.
1.5 Now create a questionnaire for the survey. Make a draft form first, discuss it and
then a final form. Be very careful about the length of each field, and give clear
instructions about how to fill it in.
1.6 Print out enough forms for the whole class, distribute them, and fill them in.
1.7 Finally, discuss as a class group with your teacher or lecturer which form was the
best and why. It is also permitted to announce the findings of the survey!
Task 2
Write a summary in not less than 100 words of your work with the group. Describe
any problems you had and how you overcame them.
Task 3
3.1 Look carefully at Figure 1, which is a simple example of a data collection form.
Would you say it was a good or bad example? Give your reasons.
3.2 Look at Figure 2, which is a report on weather conditions. Design a datacollection form for the information and data contained in it.
3.3 (For groupwork) Spend some time collecting information about cars passing in the
street. Decide in advance what sort of information would be useful, and devise a
suitable data-collection form. Collect the data, and write up a report.
Information Systems: Database Systems (H)
15
Shetland, Orkney: Overcast and windy with outbreaks of rain, some heavy. Fresh to
strong west to south-west winds. Max temp 5-7 oC (41-45 oF). Tonight, staying windy
with some more rain or drizzle. Min temp 3 or 4 oC (37-41 oF).
Caithness, Grampians, Strathspey, Moray Firth, Inverness, Aberdeenshire
Lowlands: Cloudy but mild. Brightening up for a while as any drizzle clears but it
may turn drizzly again later. Max temp 6 or10 oC (48-50 oF). Tonight, mild and mostly
dry with just the odd spot of drizzle but breezy. Min temp 4-6 oC (39-43 oF).
Western Isles, North-west Highlands, Skye, Glen Mor, Argyll: Overcast and
windy with occasional rain or drizzle and patches of hill fog. Fresh west to south-west
winds, locally strong. Max temp 9-11 oC (48-52 oF). Tonight, mild but windy with
more rain or drizzle. Min temp 5-8 oC (41-46 oF).
The Borders, the Lothians including Edinburgh, Perth and Stirling areas, Fife,
Angus including Dundee: Any early drizzle will clear with cloud thinning. This will
leave a bright and mild but breezy afternoon. Moderate to fresh south-west winds.
Tonight, partly cloudy and dry, and not too cold. Min temp 4-6 oC (39-43 oF).
Glasgow area, Lanarkshire, Firth of Clyde, Ayrshire, Galloway, Dumfriesshire:
Cloudy with occasional rain or drizzle and patches of hill fog. Mild but breezy with a
fresh west to south-west wind. Max temp 9-11 oC (48-52 oF). Tonight, windy with
some more light rain or drizzle. Min temp 5-7 oC (41-45 oF).
Information Systems: Database Systems (H)
16
Input, process & output
All data processing, whether computerised or not, has three main stages:
 input
- data is supplied to the computer
 process
- the computer manipulates (stores, sorts, etc) the data
 output
- the computer displays or prints out the results.
This procedure can be applied to most processes, for example, that of an automatic
washing machine. The machine must be supplied with clothes, liquid/powder and
water before it starts, and it is programmed to wash, rinse and spin the clothes a preset
number of times. It works automatically through all the steps of the program, and then
stops. At the end of the processing, the clothes are taken out.
Any processing involving data must go through the same three stages, and three
questions must be asked:
1. What is the input?
2. What is the process?
3. What is the output?
A simple example of data-processing is producing an electricity bill:
 What is the input? The old and new meter readings, name and address, and the
price of a unit.
 What is the process? The number of units used and the cost are calculated.
 What is the output? An electricity bill, showing the account number, name,
address, meter reading and amount due.
Flow charts
The stages involved in data-processing can be presented graphically as a data flow
chart, also known as a flow diagram. Each stage is represented by a box, connected
by arrows to show the flow of data from beginning to end. Figure 3 shows the types of
box most commonly used.
Information Systems: Database Systems (H)
17
Here is an example of a flow chart as applied to a holiday booking. Decisions have to
be made about a) the type of holiday b) the price.
Figure 4
Information Systems: Database Systems (H)
18
Figure 5 is a flow chart showing the steps (including decisions) to be followed in
making a call from a public phone box.
Figure 5
Information Systems: Database Systems (H)
19
Task 4
1.1 Analyse the following situations in terms of input - process - output:
a) recording a TV programme on a VCR
b) clocking in and out of work
c) papering a wall
d) getting a new pair of jeans.
1.2 Draw flow charts for the tasks described in question 1.1.
Task 5
In this dialogue, a car mechanic is giving instructions to a customer, whose car won’t
start. The customer knows very little about motor cars!
‘Will it start? No! Then check that you have switched on the ignition. If you have,
does the engine turn over when you press the starter switch? If the engine does not
turn over, check the battery. If the battery is flat you will have to have it re-charged,
but if you are in a hurry get someone to give you a push. It may go then. Of course
the battery wires may be loose or broken. Check them. On the other hand if the
engine turns over but does not start, you may have run out of petrol. If it’s not that, try
the spark plugs. They may be dirty. If it still won’t go when you have tried all this
ring me again.’
Turn the mechanic’s instructions into a flow chart.
Task 6
1. What are the three main stages of data-processing?
2. What are the main features of a data flow chart?
3. Draw and label the five shapes most commonly used in data flow charts.
Task 7
Look at Figures 4 and 5. For each, state the main stages in terms of a) input - process
- output b) decision making.
SUMMARY
1. Data consists of words and/or number which can be processed by a computer.
2. Information consists of data with structure and context.
3. Data has structure if it is organised into a form which can be understood by
humans.
4. Context means the situation in which data is used.
5. The main stages of data-processing are input, process and output.
6. Input is the data supplied to the computer; process is the manipulation of data
input, and output is the result of the process displayed.
7. A data flow chart is a graphic representation of the stages of data-processing.
Information Systems: Database Systems (H)
20
OUTCOME 1
‘Construct a normalised data model of an existing system.’
You have to:
 identify and describe primary entities and their component data items
 remove repeating groups from the data model
 determine and represent relationships between entities
 create a data model diagram which accurately represents the normalised data model
and existing system
 determine and describe the functions which are required to operate on the model.
First we define normalise and primary entity.
By ‘normalise’ is meant ‘remove excess data from the system’ or ‘strip the system of
redundant items’.
By ‘primary entity’ is meant ‘important or key field’.
Reminder
In all databases, whether computerised or non-computerised, the following terms are
used commonly:
 file - a collection of data
 record - all data held about one individual
 field - an item of data
For example, consider the following:
COUNTRIES OF EUROPE
Country
Capital
Population
Density
Currency
Language
Denmark
Copenhagen
5,140,000
309
krone
Danish
Eire
Dublin
3,503,000
132
punt
Erse, English
France
Paris
56,440,000
269
franc
French
Germany
Bonn
79,479,000
575
mark
German
Italy
Rome
57,662,000
496
lira
Italian
UK
London
57,411,000
608
pound
English
In the table, ‘Countries of Europe’ is a file, ‘France, Paris, 56,440,000, 269, franc,
French’ is a record, and the ‘Country’ column is a field. Thus there are six records
relating to Denmark, Eire, France, Germany, Italy and the UK, and six fields, namely,
Country, Capital, Population, Density, Currency, and Language.
Information Systems: Database Systems (H)
21
Scenario 1
Sunil is the proprietor of the Korner Mini-Mart, and wishes to expand his business by
running a video rental service from his shop. So he obtains a selection of videos from
the local supplier, and the night before launch, considers the best way to organise
things.
He comes up with the idea of customer cards, one for each customer with details of
the rental on it. He frames a card accordingly, with the following result, as shown in
Figure 6. Soon he has eight customers whose details are entered on cards as they join
the video club (Figure 7).
Figure 6
Information Systems: Database Systems (H)
22
Figure 7
Information Systems: Database Systems (H)
23
After a while, Sunil decides to add two items: a membership list and stock (video)
list. The membership list looks like this:
MEMBERSHIP LIST
James Kerr, 77 Glen Avenue
Phil Jackson, 21 Valley Road
Iona McCann, 144 Mount Drive
Helen Johnson, 38 Burn Street
Peter Parkes, 14 Lochside
Andrew Neil, 2 Field Crescent
Joan Franklin, 5 Hill Street
Linda Tomkins, 18 Meadow Lane
After a bit of juggling, he comes up with this arrangement:
MEMBERSHIP LIST
NAME
ADDRESS
Franklin, Joan
5 Hill Street
Jackson, Phil
21 Valley Road
Johnson, Helen
38 Burn Street
Kerr, James
77 Glen Avenue
McCann, Iona
144 Mount Drive
Neil, Andrew
2 Field Crescent
Parkes, Peter
14 Lochside
Tomkins, Linda
18 Meadow Lane
It’s Sunil’s first attempt at structure. As we have seen already, structure is vital in
giving data a meaning. In this case, he has hit upon one of the primary elements
which will be useful in building a datafile: order. Data must be arranged in order,
here in alphabetical order of surname.
Datafile and database
Strictly speaking there is no difference between a datafile and a database: both mean
collections or lists of structured data. However, it is also usual to associate a datafile
with paper, as in a filing cabinet, and we shall use it in that sense. By datafile we will
mean paper data, and by database electronic or computerised data.
It should be stressed at this point that Outcome 1 is entirely concerned with noncomputerised datafiles.
By adding the headings ‘Name’ and ‘Address’ Sunil has also hit on another feature of
data systems: fields.
Information Systems: Database Systems (H)
24
He now composes a list of the videos on offer, to be called the stock list. He decides
to arrange it alphabetically, and Figure 8 is the result.
Figure 8
Information Systems: Database Systems (H)
25
Normalisation
The creation of a membership and a stock list is the first stage of the normalisation
process. By this is meant the removal of all excess or redundant or repeating
items in the datafile. For example, there is no need to hold the customers’ addresses
in both the record cards and the membership lists; likewise the price of the videos
appears twice, in the video list and the customer card. The customers’ names need
only be held once, in the membership list.
It should be clear that most of the information contained in the record cards is not
required, with one exception, the date of issue. This must be transferred to the stock
list, but there is a problem. Every time the video goes out, the date must be recorded;
this means more space for this to be recorded, say, over a week. The ‘available’ field
could now be removed, too. The layout could be as follows:
VIDEO LIST
Title
Price
Certif
Apr4
Apr5
Apr6
Apr7
Apr8
Apr9
The Abyss
2.00
15
Out
In
In
Out
In
In
Batman & Robin
2.00
PG
In
In
In
In
Out
In
Contact
3.00
15
Out
In
In
In
In
Out
By now the difficulties are piling up. Most importantly, which customer has got the
video out? And on which date? Then there are variable items to be considered, such
as the price of the video according to demand. This has to be updated, and also new
videos added, something which happens frequently.
On paper, it’s a nightmare! Sunil has a vague idea that a computer ought to handle it
better, but for the moment he’s stuck with his manual system. His only consolation is
that the rental business is going well, so he has to get on with it.
Relationships
The trouble with Sunil’s manual system, though he isn’t aware of it, is the relationship
between its two primary entities, the customer list and stock list. The two lists have
what is called a many-to-many relationship. This means, each item in the
membership list for example can relate to many items in the stock list; in other words,
one customer can take out a number of videos, and conversely, one video can be taken
out by a number of customers.
This is illustrated by Figure 9.
Generally speaking, a many-to-many relationship is to be avoided; any such system
may prove frustrating and in the end unworkable. What is required is to take the
normalisation process on to another stage.
Information Systems: Database Systems (H)
26
Figure 9
Information Systems: Database Systems (H)
27
The third stage
Sunil’s final solution is rather desperate: an old notebook in which he records the
daily transactions, hence the name transaction records. The format is as below.
TRANSACTION RECORDS
Date
Title
Member
Retr
Date
Title
Member
Retrnd
4/4
Vampire in B
Franklin
Yes
6/4
Full Monty
Jackson
Yes
4/4
Species
Franklin
Yes
6/4
Tomorrow Nev DJackson
Yes
4/4
Contact
Johnson
Yes
6/4
Starship Troop
Parkes
Yes
4/4
Ransom
Parkes
Yes
7/4
Mic Collins
Neil
Yes
4/4
Starship Troop
Tomkins
Yes
8/4
Full Monty
Kerr
Yes
5/4
Spice World
Franklin
Yes
8/4
Lion King
Johnson
Yes
5/4
Starship Troop
Franklin
Yes
8/4
Mission Impos
Tomkins
Yes
5/4
Titanic
Johnson
Yes
9/4
Forrest Gump
Jackson
Yes
5/4
Spice World 2
Johnson
Yes
10/4
Titanic
Franklin
No
5/4
Full Monty
McCann
Yes
10/4
Full Monty
Johnson
No
6/4
Independ Day
Kerr
Yes
10/4
Contact
Kerr
No
Notice that there is still repetition in the two primary entities, video and member
names, even though they are often abbreviated. An extra complication is that now
there is more than one copy of the videos. One improvement would be to give the
members a number from one to eight, and transfer that number to the transaction
record. Logically, the next step would be to give each video a number, too.
Thus, the members would be numbered from 1-8 and the videos, say, from 101-125.
The new look transaction records would read:
4/4
125
1
Yes
4/4
121
1
Yes
4/4
103
3
Yes
This would make sense for a computer, but would be confusing for a human shop
assistant, used to dealing with names and not numbers.
However, in this latest version of the scenario, we have achieved what is known as a
one-to-many relationship. The membership list has a one-to-many relationship with
the transaction records, since each transaction record relates to only one member.
Likewise the stock list has a one-to-many relationship with the transaction records,
since each transaction record relates to only one video.
Information Systems: Database Systems (H)
28
This has been a detailed description of the video rental scenario, but it can be
summarised as follows:
Stage 1
Individual record cards with these data items (fields): customer’s name, customer’s
address, date issued, title, date returned, price.
Stage 2
Record cards
Stock list with these fields: title, price, available, certificate
Customer list with these fields: name (arranged alphabetically), address
Normalisation results in the removal of repeating items from the record cards. The
customer’s name and address are transferred to the customer list, and the video title
and price to the stock list. This meant the deletion of customer cards as the
information in them was largely redundant.
However, the overall result was a many-to-many relationship, which proved to be
unworkable.
Stage 3
Transaction records with these fields: date issued, title, member, date returned.
Further normalisation meant the replacement of the video title by a number
corresponding to the stock list, and of the member’s name by another number
corresponding to the customer list.
The result was a one-to-many relationship, as each transaction record relates to one
member and one video.
Data dictionary
All the data can be classified in what is known as a data dictionary. This means a
list of all data types used in the scenario.
The fields are of the following types (the range will be extended later):
1) alphanumeric (consisting of words or a combination of words and numbers)
2) numeric (consisting of numbers)
3) date (consisting of dates).
DATA TYPES
alphanumeric
numeric
date
customer’s name
price
date issued
customer’s address
customer’s number
date returned
title
video number
available
certificate
Information Systems: Database Systems (H)
29
To summarise
The exploration has been a bit lengthy, but is a necessary preparation for the
conversion to a computerised system which is to follow. This is the case with all
paper (manual) systems, in which all transactions are carried out by a human being.
Returning to the scenario, we could say that Sunil now has a workable arrangement
for his video rental business. He has three pieces of paper (see Figure 10):
 a membership list, in alphabetical order, and numbered
 a stock list of his videos, in alphabetical order, and numbered
 transaction records.
Figure 10
Information Systems: Database Systems (H)
30
The disadvantages of this system are:
 the membership and stock lists, once added to, will no longer be in alphabetical
order. If Sunil re-sorts the names manually, they will no longer be in numerical
order
 the transaction records are flat, that is, the information contained in them cannot
be transferred to either the membership or stock list.
Consequently, after a few weeks of processing, Sunil has a vast list of transaction
records which are largely unusable. Imagine the situation after a few months!
Ideally, Sunil would want a system whereby the data contained in the transaction
records could be transferred to the membership and stock lists with little effort. He
would then have detailed lists, for example, of a) what videos each member had rented
and b) which videos were most popular c) the status, in or out, of any given video d)
which members were in arrears.
The ideal device for such a system is a computer database. If he wanted any of these
things with his current system, he would have to write out manually new lists taken
from the transaction records, as follows:
(A) LIST OF MEMBERS & VIDEOS
Member
Video
Franklin
Vampire In Brook
Spice World
Retrnd
Video
Retrnd
5/4
Species
6/4
9/4
Starship Troopers
8/4
Contact
5/4
The Titanic
6/4
Spice World 2
6/4
The Lion King
7/4
The Full Monty
6/4
The Titanic
Johnson
Information Systems: Database Systems (H)
31
(B) LIST OF MOST POPULAR VIDEOS
Video
Date
Vampire in Br
4/4
Species
4/4
Contact
4/4
Ransom
4/4
Starship Troop
4/4
5/4
Spice World
5/4
5/4
The Titanic
5/4
10/4
The Full Monty 5/4
Date
Date
Date
Date
Date
Date
Date
Date
Date
10/4
6/4
6/4
8/4
10/4
( C) STATUS OF VIDEOS
Video
In/Out Video
In/Out Video
In/Out Video
In/Out
Vampire in Br
In
Species
In
Contact
Out
Ransom
In
Starship Troop
In
Spice World
In
Spice World 2
In
The Titanic
Out
The Full Monty Out
Independ Day
In
Michael Collins In
The Lion King
In
Mission Impos
Forrest Gump
In
In
This last list would be particularly useful every time a customer came in to make an
enquiry as to a particular video’s availability. In a manual system it would be possible
to do this only periodically.
Information Systems: Database Systems (H)
32
Extended scenario
The time has come to extend the scenario and formalise the structure into tables.
Present system
Korner Mini-Mart Video Club operates a paper system of recording details manually
on a variety of paper formats:
 The club has individual cards for each customer (name, address, current balance,
credit limit, and phone number if applicable). These cards are indexed, that is,
they are arranged in order of surname)
 A paper list of videos (the stock list) is kept with these details: the video’s title, its
price of hire, certificate, category, and availability. ‘Category’ is defined as a
subject matter, e.g. western or thriller. This list is also indexed on the title.
 Details of day-to-day transactions are recorded separately in a book with items such
as the video title, the customer’s name, the price, date of issue, and whether or not
it has been returned.
 The owner also sends out paper invoices for customers who hire on credit. These
contain the customer’s name, address and balance.
The owner would like a system which printed out reports such as the most popular
videos, or those customers with outstanding balances, but is unable to do so with his
present system.
The following table, Figure 11, represents the data model before normalisation.
Figure 11
Entity
Members Records
Video Records
Transaction Records
Invoice Records
Data Items
Name
Address
Balance
Credit Limit
Telephone Number
Title
Hire Price
Certificate
Category
Availability
Name
Title
Hire Price
Date of Issue
Returned
Name
Address
Balance
Information Systems: Database Systems (H)
33
NOTES
1. Members are to be allocated a unique 2-digit number in the range 1-99.
2. Balances may be positive or negative.
3. Addresses may cover one, two or three items.
Relationships
Many-to-many
There is a many-to-many relationship between the Members Records and the Video
Records. Each member can have many videos, and each video can be hired by many
members.
One-to-many
There is a one-to-many relationship between:
1) Transaction Records and Members Records. Each Transaction Record relates to
only one member.
2) Transaction Records and Video Records. Each Transaction Record relates to only
one video.
3) Invoice Records and Members Records. Each Invoice Record relates to only one
member.
These relationships can be expressed in diagrammatic form, as in Figure 12.
Figure 12: Entity-relationship diagram
Transaction Records
Member Number
Video Number
Members Records
Member Number
Video Records
Video Number
Invoice Records
Member Number
Video Number
Information Systems: Database Systems (H)
34
Normalisation
The process of normalisation, which we have defined as the reduction and/or
elimination of all excess items, can be seen in Figure 13. Notice that unique fields are
underlined, and repeat items are in bold.
Figure 13: normalisation
Information Systems: Database Systems (H)
35
Extended data model (data dictionary)
Figure 14 shows the extended data model, which is also known as the data dictionary,
because it lists all entities and data items of the normalised model, with a description
of each item.
Figure 14
Entity
Members Records
Data Items
Member Number
Name
Address
Balance
Credit Limit
Video Records
Telephone Number
Video Number
Title
Hire Price
Certificate
Category
Availability
Transaction Records
Invoice Records
Video Number
Member Number
Hire Price
Credit Limit
Date of Issue
Returned
Member Number
Name
Address
Balance
Information Systems: Database Systems (H)
Description
Unique member identifier; required;
integer number in range 1-99
Member name; alphanumeric;
required
Member address; alphanumeric;
required
Real number (2 dec figs) in range
0-1000; may be positive or negative; required
Real number (2 dec figs) in range
0-1000; required
Alphanumeric; not required
Unique video identifier; required;
integer in range 100-999
Alphanumeric; required
Real number (2 dec figs) in range
1-99; required
Suitability of video for children;
alphanumeric; required
Subject matter of video, eg western;
alphanumeric; required
Whether in shop or not; Yes/No;
required
See Video Records; required
See Members Records; required
See Video Records; not required
See Members Records; not required
Date format day/month/year; each
number 2 digits; required
Alphanumeric; Yes/No; required
See Members Records; required
See Members Records; required
See Members Records; required
See Members Records; required
36
Notes
1. The data items and structures are suitably named.
2. In this example ‘entity’ equates to ‘file’, and ‘data item’ to ‘field’.
3. Thus there are 4 entities, ‘Members Records’, ‘Video Records’, ‘Transaction
Records’, and ‘Invoice Records’.
4. The ‘description’ relates to validity checks, which are as follows:
 unique identifiers
 whether or not required; if required, the field must be filled in, if not required, it
can be left blank.
 numbers can be ‘real’, that is decimal fractions, or ‘integer’, that is whole
numbers.
 numbers are also given a range, e.g. 1-99, and can be positive or negative.
 text can be alphanumeric, that is characters (letters) or a combination of
characters and numbers
 dates are usually in the British format of day/month/year.
 Yes/No means ‘answer Yes or No’.
‘See Members Records’ means a lookup or link (relation) to another
entity/file/form.
Exercises
A number of scenarios now follow, featuring some typical manual systems. You have
to analyse these as follows:
1. identify and describe the primary entities (main fields) and data items
2. normalise the data items, especially by removing repeating items, and show this in
a table
3. describe the relationships, either many-to-many or one-to-many, between the
primary entities (main fields) during the normalisation process
4. show the relationships in an entity-relationship diagram
5. describe the normalised data model (data dictionary) of the system, in a table
6. describe clearly the inputs, processes and outputs associated with the system
7. state whether each data item is required or not
8. describe the advantages of computerising the system, including potential uses of
the stored data.
Task 8
Scenario
Mackay & Wells Opticians have a paper (manual) system of patient records which
consist of the patient’s name, address, phone number, date of birth, sex, date of last
treatment, eye condition, and eye disease (if any).
There are separate treatment records which have the following items: date of
treatment, type of treatment, eye test, spectacles details, patient details (name, address,
DOB, eye condition), date of next appointment, and cost of treatment.
Information Systems: Database Systems (H)
37
The firm has a stock list consisting of: the type, colour, and price of frames, and the
type and price of lenses.
A further book list logs the patient’s next appointment, which is normally once a year,
and an invoice list records payments due. Both of these lists record the patient details.
Notes
1. Each patient is to have a unique identifier number, in the range 1-99.
2. The field Eye Condition has entries such as ‘short-sightedness, astigmatism’.
3. The Address item may have up to three lines of entries, the last of which is
optional.
Task 9
Scenario
Hamish Scott is realising a childhood ambition: he is setting up his own business as a
second-hand book dealer. He has purchased a stock of books from various sources,
and now has enough to get started. He decides to make a card list initially of books,
one card for each book, and thinks carefully about what information to hold. He picks
up his first book, and writes down a few items:
Chaplin - His Life and Art, by David Robinson, published by Collins, 1985,
biography, ISBN No 0-12-46833-3, hardback, non-fiction.
Presently he has a working (manual) system, as follows:
 a card index of books consisting of book title, author, publisher, date of printing,
category (subject matter, such as western or biography), ISBN (International Book
Standard Number), type (hardback or softback), and price
 a customer list consisting of customer details (name, address, phone number, credit
limit, balance, credit card type, credit card number)
 an invoice form with name, address, balance
 transaction records containing the following items: title, author, name, address,
price, method of payment, payment made, payment due.
The owner would like to have lists in order of title, author, publisher, and category,
and is unable to do so with his present system.
SUMMARY
1. A datafile is a collection of data held on paper; a database is a collection of data
held in a computer.
2. In datafile or database, a file is a collection of data; a record is data held about
one individual; a field is an item of data.
3. In a datafile, the term primary entity means ‘main field’.
4. Normalisation means the elimination of all excess data items, especially that of
repeating items.
5. Data is normally held in order, either alphabetical or numerical.
Information Systems: Database Systems (H)
38
6. A many-to-many relationship is one in which all the items of data on one list can
relate to all items on another list, for example, data in a membership and stock list.
7. A one-to-many relationship is one in which a single data item in one list relates
to many data items in another list.
8. A data dictionary is a list of all data types in a file.
9. The data in fields can be of three types:
 alphanumeric (consisting of words or a combination of words and numbers)
 numeric (consisting of numbers)
 date (consisting of dates).
10. Data lists are flat if they cannot be transferred to other lists.
11. The advantage of computerisation is that data can be manipulated (for example,
sorted) with little effort.
Information Systems: Database Systems (H)
39
Database management
A database system is essentially a computerised record-keeping system, rather like an
electronic filing cabinet. The advantages of database systems over paper filing
systems are considerable, and can be summarised thus:
 compactness - there is no need for large paper files
 speed - a computer can retrieve, change and display data far quicker than a human
being can. Random queries can be answered instantly.
 less drudgery - the tedium of maintaining and updating paper files is reduced
enormously.
 currency - accurate, up-to-date information is obtainable on demand.
These are general advantages, but there are additional, particular advantages to be
gained from a stored data system:
 redundancy can be reduced, especially where there are duplicated items in files. As
a result key items are held only once, but can be linked to other files (the relational
principle).
 inconsistency can be eliminated, when data items are given in different forms. For
example, where a business is known as Scott’s Garage, J Scott Garage, J Scott &
Son Ltd, or where an item is updated in one file but not in another.
 access to the data can be strictly controlled, by means of a password system.
The user of such a system can normally expect to be able to perform a number of
operations on the database. By ‘operations’ is meant ‘what can be done’, that is,
actions. The most common operations are the following:
 adding new files
 inserting new data into existing files
 retrieving data from existing files
 updating data in existing files
 deleting data from existing files
 removing existing files from the database.
Here is an example (Figure 15), the ‘Countries of Europe’ file, which shows the
operation of retrieval with the results (for brevity, we shall rename the file ‘Nations’).
Retrieval:
SELECT COUNTRY, POPULATION, DENSITY
FROM NATIONS
WHERE DENSITY < 400
Information Systems: Database Systems (H)
40
Figure 15
Country
Capital
Denmark
Eire
France
Germany
Italy
Sweden
UK
Copenhagen
Dublin
Paris
Bonn
Rome
Stockholm
London
Population
(in millions)
5.14
3.50
56.44
79.48
57.66
8.56
57.41
Density
(per sq mile)
309
132
269
575
496
49
608
Currency
Language
krone
punt
franc
mark
lira
krona
pound
Danish
English
French
German
Italian
Swedish
English
Result:
COUNTRY
Denmark
Eire
France
Sweden
POPULATION
5.14
3.50
56.44
8.56
DENSITY
309
132
269
49
Inserting new data:
INSERT
INTO NATIONS ( COUNTRY, CAPITAL, POPULATION, DENSITY,
CURRENCY, LANGUAGE )
VALUES ( SPAIN, MADRID, 66.5, 150, PESETA, SPANISH )
Update existing data:
UPDATE NATIONS
SET POPULATION = 57.9
WHERE NATION = ITALY
Delete existing data:
DELETE FROM NATIONS
WHERE COUNTRY = CZECHOSLOVAKIA
The above are all examples of a database language called SQL (Structured Query
Language). SQL is a language widely used in commercial database systems; indeed,
it has become almost the official language for relational databases.
Relational databases
The definition of a relational database is given in C. J. Date’s book An Introduction to
Database Systems as follows: ‘a system in which the data is perceived by the user as
tables….. and in which the user can generate new tables from old.’ To extend this
definition for our own purposes, we can say that key data in one file is linked or
chained to data in another (hence relations).
Information Systems: Database Systems (H)
41
A number of commercial products have appeared since the late 1970s, and as many as
200 are now available for all platforms. Examples include DB2 from IBM, The
Paperless Office from Computhink, and Microsoft Access 97 (Windows 95).
Software familiarisation
Easy Base
The next outcome is concerned with the design of database structures, but before we
do this, it is important for you to become familiar with a database package, and
especially with a relational database. We have based the following worksheets on a
DOS package called Easy Base.
Here is a glossary of terms that you will find useful as you progress through the
exercises:
Field
Record
Form
Procedure
Relationship
forms
the storage space for an individual data item
a set of related data items
the storage space for a set of records (‘file’ elsewhere)
a set of instructions which manipulate the data stored in forms
a record in the relationships form recording a link between
To start Easy Base, type: EB
Select ‘Samples’, with the password provided, and then Option 1 ‘Read this first’.
Select Option 2, ‘Aircraft Procedures’, and using the sub-menu browse through the
data, which is displayed as follows:
1. the aircraft in order (use PageUp and PageDown)
2. the aircraft in groups
3. the aircraft list by types
4. the aircraft with nationality (source country)
5. select one type of aircraft.
Task 11
Use Escape to go back to the previous menu (the ‘Samples’ directory), and select
Option 3, ‘Transaction Procedures’, and then Option 1, ‘New Customers’. Enter the
following details:
£144, Jim Green, 14 Kelvin View, Glasgow, G12 3AB, 0141 111 2233
£0, Sue Black, 88 Broomie Road, Glasgow, G3 4CD, 0141 112 3455
£540, Ken Gray, 70 Mound Street, Edinburgh, EH4 5DE, 0131 223 4566
£21, Pat White, 140 Castle Avenue, Edinburgh, EH6 7JK
£77, Mel Plant, 24 Post Road, Dundee, DD12 6EF, 01382 499 228
£0, Gil Bush, 105 Bridge Drive, Dundee, DD13 7GH, 01382 255 198
£85, Joy Flowers, 2 Rig Lane, Aberdeen, AB5 6MN, 01224 598 699
£114, Bill Rose, 34 Buchan Road, Aberdeen, AB7 8PQ, 01224 677 432.
Press F2 to update form (file), and press Escape.
Information Systems: Database Systems (H)
42
Task 12
Select Option 2, ‘Address Change’, and make the following changes (let’s assume the
customers are leaving the area):
Gil Bush’s new address is 26 Pier View, St Andrews, SA4 6BH, and her new phone
number is 01334 612991.
Sue Black’s new address is 277 Birrell Drive, Glasgow, G5 6PP, and her new phone
number is 0141 484 7731.
Update the form as before, and press Escape.
Task 13
Select Option 3, ‘Delete Customer’, and delete the customer records of Sue Black and
Mel Plant. The software disallows one of the deletions - which one? And why? How
do you think the program is written to deal with such an eventuality? Report on your
findings.
Update again, and return to the ‘Sample’ directory menu by pressing Escape twice.
Task 14
Select Option 4, ‘Address Labels/Form Letters’, then Option 2, ‘Form Letters’. Enter
a * followed by Return as requested, and on the following sub-menus select Option 1,
‘Bundled Software’, and Option 3, ‘Magazine Editors’. Get a printout (there should
be five letters).
Task 15
Back on the ‘Sample’ menu (press Escape three times), select Option 5, ‘Multi
Lookups on Invoice’ (a ‘lookup’ is a relation). Use the * again and on the sub-menu,
enter 12 gizmos and 20 widgets, and write down the total.
To the prompt ‘Exit Abandon Changes’, enter ‘Yes’.
Task 16
Back on the ‘Samples’ menu, select Option 6, ‘Browse and Print/Process’. Select
Option 1, ‘Read this First’, then Option 2, ‘Select and print Aircraft Records’.
Browse through the records using F4 and F5, then look at Record 1, the ‘Percival
Petrel’.
Name the fields, and comment on the type and number of the fields (type =
alphanumeric or numeric - see page 29).
Task 17
Get two printouts of Record 2, the ‘Avia’, using a) F11 b) F2. What are the
differences? Now search for the ‘De Havilland Mosquito’ record using F3, and print
it out using F11.
Information Systems: Database Systems (H)
43
Task 18
Return to the ‘Browse and Print/Process’ menu, and select Option 3, ‘Select with
option’. Using onscreen search facilities, search for the ‘Bristol Blenheim’. Then
using F2, print out its record plus a list of other aircraft by the same manufacturer.
Task 19
Returning to the ‘Sample’ menu, select Option 7, ‘Configuration’. You can customise
your screen colours with Option 4 and, amongst other things, enable the screensaver
and change menu borders.
Task 20
Return to main menu and select Option 4 - Data Directory. Select ‘Samples2’ and
enter the password. Now select Option 1 - Lookup Examples, and on the sub-menu
select, ‘Read this’, followed by Option 2, ‘Simple Lookup’. Enter customer numbers
1-4 and browse through the records. What lookup (relationship) is used? Add £200
to all four credit limits and press F2 to update.
Task 21
Back on the sub-menu, select Option 3, ‘Compound Lookup’. Enter a * followed by
Return to select a customer. What lookup (relationship) is used? Add £200 to John
Turnbull of 3 Brookside Court’s record, and update.
Task 22
Return to the sub-menu, and select Option 4, ‘Double Lookup’. Enter a * to select
customers. Summarise the procedures and lookups involved here. Why is this
process necessary? Add £200 to each of the following records: John Smith of Dolby,
and John Turnbull of Pensacola. Update both records, and browse again. Explain
how the software displays the figure for the credit limit. What is happening here?
Task 23
On the sub-menu again, select Option 5, ‘Data Entry to Customer Form’. Press F5 to
view the four records. How is the field at the foot of the screen made up? Add the
following records (5 and 6):
Anne Brown
Anne Brown
15 St James View
190 Wirral Rise
Newcastle-upon-Tyne
Liverpool
NE31 4XY
L18 3BH
Now update the file (F2). What message appears? And why?
Enter the same credit limit for both records and update. View the data using F5. For
details of function keys, press F1.
Now initiate a search by pressing F3 and using a *. Move the cursor through the
fields ‘Forename’ and ‘Surname’. Summarise what happens.
Task 24
Return to the ‘Examples’ menu, and select Option 2, ‘Date and Time Examples’. On
the sub-menu, select Option 1, ‘Date Formulae’. Explain what is meant by ‘This date
defaults to the system date’. Change the date as indicated and try some incorrect
Information Systems: Database Systems (H)
44
dates like 30/02/99. How does the program cope with this? And what process is
being carried out? Try these two dates: 29/02/00 and 29/02/02. Write down the
valid date range.
Task 25
Finally, return to the ‘Examples’ menu, and select Option 4, ‘Calculation Examples’.
Browse.
SUMMARY
1. A database system is an electronic record-keeping system.
2. The advantages of electronic systems over paper systems are;
 compactness (vast storage in a small space)
 speed (a computer can process data very quickly)
 less drudgery (tedium of keeping paper files is reduced)
 currency (information is accurate, up-to-date, and instantly available)
 duplication can be reduced
 inconsistency can be avoided
 access to data can be made secure.
3. The following operations can be performed on data:
 adding new files
 inserting new data
 retrieving data
 updating data
 deleting data.
4. SQL (Structured Query Language) is widely used in modern databases.
5. A relational database is one in which data in one file can be linked (related) to data
in another.
Information Systems: Database Systems (H)
45
OUTCOME 2
‘Design database structures to represent the normalised data model.’
You have to ensure that:
 the database structure and data item names are appropriate to the data model
 unique keys are chosen for all database structures
 data item characteristics correctly represent the data model
 data item validity checks correctly represent the data model
 designed database structures are appropriate to the intended implementation
method.
Designing a database structure
In a small business, it is important to have two lists: a stock list and a customer list.
The customer list should hold your customers’ names, addresses, credit limit etc. If
you sell or hire things, you must create a form (file) - please note that the Easy Base
terminology described on page 40 will be followed - to hold each of your stock items
with their name, number, price etc. These two are your ‘core’ or primary data forms
from which you ‘lookup’ data for various purposes: they link or chain with other
forms which we will call secondary forms. Each of the primary forms must have an
identifier or ‘unique’ field such as stock or customer number, which will allow the
linkup to be made.
Choosing the right names
The choice of names which you give to fields is also most important, and you should
think carefully before choosing them. In Easy Base the following points are
recommended:
1. Choose short names which fully describe the field
2. The names of forms (files) should be plural and the names of fields singular.
For example, a form which holds members of a club should be called ‘Members’, and
the fields ‘MembersNo’, ‘Name’ and ‘Address’. The list of videos, the form,
becomes ‘Videos’, and its fields ‘Title’, ‘Price’, Avail’, ‘Cert’, and ‘VideoNo’. When
you have to lookup data, the lookup function will be written, lookup(videos, title);
and likewise procedures will be written as videos.title or members.name.
It is also important, if you have two related forms, that linked fields should have
exactly the same names. For example, in the video shop scenario, if the owner
established a customer accounts form which had the name and balance or credit limit,
then these fields should have the same names in the members form.
Unique fields
Each form (file) must have a definition or unique field which should be fairly obvious.
The definition field has a vital function, to uniquely identify a form. In the ‘Members’
form, the unique identifier is ‘Name’, and in the ‘Videos’ form, it is ‘Title’. There is a
secondary purpose, namely, to prevent duplication of entries. This occurs commonly
when for example two persons have the same name, such as ‘John Smith’; in which
case two fields could be joined together to form another field, e.g. ‘Name’ and
‘Address1’, which then becomes the unique identifier. See also Task 22 on page 44.
Information Systems: Database Systems (H)
46
So the conventions for Easy base are:
 form means ‘entity’ or ‘file’, that is, a collection of data items, or storage space for
a set of records
 field means ‘individual data item’, or the storage space for such an item
 record means ‘set of related data items’, or all the data about one individual
 names must be short but descriptive, normally a maximum of 10 characters
 form names should be plural, and field names singular
 lookup means a relational link between two forms
 fields which hold the same data in different forms must have the same name
 each form must have a definition field, that is, a unique identifier of the form.
Easy Base has these further features:
 the field length for text is for most entries up to 40 characters, but for extended
text descriptions may be double that
 field names may have any characters (letters, numbers or symbols) including a
space, #, “, &, ^, *, (), ‘, %, but not ?, !, or the full stop or comma. Names must
begin with a character, not with a space, but the software has automatic correction
in this case.
 data types may be text, integer (whole number), fixed point (the number of digits
after the decimal point is specified), floating point (number of digits is
unspecified), date (in the range 1981 to 2080), time, choice, formatted text (e.g. for
other dates), and text block
 the length of integers may up to 14 characters
 for fixed point numbers, digits are specified to right and left of the point
 fields can be mandatory (required), unique, indexed (arranged in order), and
derived (defined with a formula).
We now apply those features to the video shop scenario in tabular form, as in Figure
16. We shall call the database KornerMM and its four files (forms) Members,
Videos, Transacts, and Invoices. The data item (field) called ‘Name’ in ‘Members’
will be subdivided into two fields called ‘Forename’ and ‘Surname’, and the field
‘Address’ subdivided into ‘Address1’, ‘Address2’, ‘City’ and ‘PostCode’. ‘Members’
will also have a further field called ‘Name’, made up of ‘Forename’, ‘Surname’ and
‘Address1’, as a validity check for duplicates. There will be an extra field in ‘Videos’
called ‘StarName’ to indicate the film’s leading actor (if known). The ‘Transacts’ file
will have additionally the video title, member’s name, and the transaction number.
The ‘Invoices’ file will have full details of the member’s name and address, the
amount due, the video number, title and price, and the date of the invoice.
Information Systems: Database Systems (H)
47
Figure 16
KornerMM Database: Members File
Field Name
Forename
Surname
Address1
Address2
City
PostCode
MemberNo
CreditLimit
Balance
Name
Type
Text
Text
Text
Text
Text
Text
Integer
Fixed point
Fixed point
Text
Size
15
15
40
40
30
20
5
4, 2
4, 2
70
Mandatory
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
No
Indexed
Yes
Yes
Yes
No
No
No
Yes
No
No
No
Derived Range
No
No
No
No
No
No
No
1-1000
No
1-100
Yes
Yes
KornerMM Database: Videos File
Field Name
VideoNo
Title
HirePrice
Certificate
Category
Available
StarName
Type
Integer
Text
Fixed point
Text
Text
Text
Text
Size
5
40
4, 2
5
20
5
30
Mandatory
Yes
Yes
Yes
Yes
Yes
Yes
No
Indexed
Yes
Yes
No
No
Yes
No
Yes
Derived Range
No
1-1000
No
No
1-100
No
No
Yes
No
Indexed
Yes
Yes
No
Yes
No
No
No
No
Yes
Derived
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
No
KornerMM Database: Transacts File
Field Name
VideoNo
Title
HirePrice
MemberNo
Name
DateIssue
CreditLimit
Returned
TransactNo
Type
Integer
Text
Fixed point
Integer
Text
Date
Fixed point
Text
Integer
Size
5
40
4, 2
5
70
10
4, 2
5
8
Mandatory
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Information Systems: Database Systems (H)
Range
1-1000
1-100
1-1000
dd/mm/yy
1-100
1-10000
48
EXERCISES
Task 26
26.1 Create a table on the basis of Figure 16 showing the ‘Invoices’ file of the
‘KornerMM’ database. For additional help with relationships, you should
consult Figures 12, 13 and 14.
26.2 Create database structures (tables), again on the basis of Figure 16, of the
optician scenario as described in Task 8 (page 37). There are four files (forms),
so you require four tables.
26.3 Create database structures (tables) as above, of the book dealer scenario (Task 9
on page 38). There are again four files.
26.4 In the book dealer scenario, consider the statement on page 38, ‘The owner
would like to have lists in order of title, author, publisher, and category, and is
unable to do so with his present system.’ How would your database structure
design enable the owner to make these lists?
SUMMARY
1. In most databases, there are primary forms (files) from which linkups or
relationships can be made.
2. Each primary form must have a unique or definition or identifier field (often called
the unique key) which allow the linkup to be made.
3. Field names should be short and descriptive.
4. In Easy Base, the names of forms (files) should be plural and the names of fields
singular.
5. In related forms, the linking field names must be the same.
6. To prevent duplication, fields may be combined to give a second identifier.
7. In Easy Base, form means a file, and lookup means a linkup.
8. Further features of Easy Base:
 the field length is normally 40 characters, but may be 80
 field names may have any characters except the question mark, exclamation
mark, comma and full stop
 data types may be text, integer, fixed point, floating point, or date
 the length of integers may be up to 14 characters
 for fixed point numbers, digits are specified to the right and left of the point
 fields can be mandatory, unique, indexed, and derived, or a combination of
these.
Information Systems: Database Systems (H)
49
OUTCOME 3
‘Implement a designed database structure.’
You have to ensure that:
 your designed database structure is correctly implemented
 data manipulations are performed effectively
 queries are carried out efficiently to meet given criteria
 reports are produced to meet given specifications.
Form design
We will use the video shop scenario to illustrate the design of forms, along the lines of
Figure 17.
Figure 17
On the opening window, enter a new directory name for your form, ‘KornerMM’, and
any password required. From the Easy Base main menu select ‘Form Design’
followed by ‘Design New Form’, giving it the name ‘Template’. The design screen is
blank, but to select the borders shown above, press function key F3 and select Option
1, ‘Line Drawing’. Draw the outer border using Ctrl + Alt and arrow keys, and the
inner border using Alt and arrow keys. For the shading at the foot of the screen, press
F3 and select Option 2, ‘Shading’. Draw the lower shading using Ctrl + Alt and
arrow keys, and the upper shading using Alt. To get to any previous screen press
Escape.
The outline of the ‘KORNER MINI-MART VIDEO CLUB’ box is done by selecting
‘Line Drawing’ and using Ctrl and arrow keys. The colours of the text can be
customised by pressing F4 and selecting, for example, colour 2; then simply hold
down Shift and drag the cursor under the text.
To save the template, press F2. This will now be used for all your forms.
Information Systems: Database Systems (H)
50
On the main menu, select ‘Design Form’, then ‘Copy Existing Form’, selecting the
name ‘Template’. Now give it the new form name ‘Members’.
On line 3, column 5, enter the word ‘Forename’, which is your first field. Press F10
to define the field, and select options as shown in Figure 18.
Figure 18
Field Name….
“Forename
“
Field Data Type……………. Text
Field Length……………….. 15
Is an Entry Mandatory…….
Yes
Is this the Unique Field……
No
Index this Field……………
No
Allow User Entry…………
Yes
Display Contents as………
Field
Is the Field derived………
No
Notes
1. You must provide entries for the first three fields; the others have preset defaults
which you can change at will. For the entry ‘Is an Entry Mandatory’, leave the
default message ‘This field must be filled’. If you enter ‘Yes’, the user is obliged
to make an entry; if you enter ‘No’, the field is skipped. The third option ‘If’ need
not concern us for the moment.
2. Be careful when selecting the unique field, and be sure to choose only one.
Indexing is automatically set to ‘Yes’ for this field.
3. Remember that indexed fields are automatically arranged in order, either
alphabetically or numerically.
4. ‘User Entry’ has a default setting of ‘Yes’, but can be set to ‘No’ or ‘If’. If it is set
to ‘No’, the user will not be able to visit the field; in other words, the contents
cannot be changed. The field, for example, might be derived from another.
5. The ‘Display Contents’ menu allows you to change the text display background
and the colour of text as follows:
 FIELD: text is displayed in default colour in a coloured block
 TEXT: text is displayed against the main coloured background
 1ST ALT COL: first alternate text colour
 2ND ALT COL: second alternate text colour
 BLINKING: the contents blink! (To draw attention to the entry)
Information Systems: Database Systems (H)
51


INVISIBLE: neither the field size nor contents can be seen
CODEWORD FIELD: the entry shows up as a series of stars. For use with
menus where passwords are required.
Press F2 to save the definition. You should now see a block of red for the field, and a
field summary at the top of screen. Move the cursor to Column 30, and enter
‘Surname’. Press F10, and enter the same field definition as Figure 19 with these two
exceptions:
for Field Name, enter ‘Surname’, and for Index this Field, enter ‘Yes’. The reason for
the latter change is simply that we may easily wish to have a list in alphabetical order
of surname, so the field must be indexed.
Save with F2. Move the cursor to beginning of the next line, and type ‘Address’.
Press F10 for a new field definition, and enter these details:
Field Name:
Field Data Type:
Field Length:
Is Entry Mandatory:
Is this the Unique Field:
Index this Field:
Allow User Entry:
Address1
Text
40
Yes
No
No
Yes
Save with F2. Move to the next line under the red block and press F10. The Field
Name is ‘Address2’, and this time entry is not mandatory (because some people have
only a single line of address). Save again.
Now fill in the rest of the details as indicated in Figure 17, using F10 to define each
field. The definitions are as follows:
Field ‘City’, Text 15, Mandatory, Field
Field ‘PostCode’, Text 20, Field
Field ‘MemberNo’, Integer 6, Mandatory, Unique, Indexed, Field (this is the unique
field)
Field ‘CreditLimit’, Fixed point 8, Mandatory, Field
Field ‘Balance’, Fixed point 8, Mandatory, Field
Field ‘Name’, Text 40, Mandatory, Derived, Text.
The last entry is derived from a combination of Forename, Surname and Address1,
and provides an additional identifier. Enter ‘Yes’ to the prompt ‘Is the Field Derived’,
and enter the following formula: jointext(Forename,“ ”,Surname, “ ”,Address1).
This combines three fields, forename, surname, and address1, and is referred to as
‘Name’.
Information Systems: Database Systems (H)
52
Now save changes and form with F2. You are now ready to enter data, so select
Option 2, ‘Data Entry’, and form name ‘Members’. Enter the following details:
James Kerr, 77 Glen Avenue, Moretown, MN3 4KL, 1, 100. (Leave the field
‘Balance’ blank for the moment; we will return to it later)
Phil Jackson, 21 Valley Road, Moretown, MN4 9GR, 2, 100
Iona McCann, Rose Cottage, 144 Mount Drive, Port James, MN6 1HW, 100
Helen Johnson, 38 Burn Street, Moretown, MN8 2DQ, 4, 0
Peter Parkes, Killin, 14 Lochside, Moretown, MN5 5MV, 5, 50
Andrew Neil, 2 Field Crescent, Port James, MN6 8FT, 6, 25
Joan Franklin, 5 Hill View, Port James, MN6 2GP, 7, 100
Linda Tomkins, Benachie, 18 Meadow Lane, Moretown, MN8 5HC, 8, 100
Martina Kemp, 4 Hedgerow Lane, Moretown, MN7 3BZ, 9, 50
Francis McKean, Ettrick, Wood Row, Port James, MN6 2JY, 10, 100.
If you have entered your data and formula correctly, you should see on your display
the automatic entry of the field ‘Name’. If not, look up your field definition, and
check you have entered the formula for ‘Derived’ correctly.
Task 27
Look at Figure 19. You are now going to create a form called ‘Videos’. On the main
Easy Base menu, select ‘Form Design’, then ‘Copy Existing Form’, then ‘Template’.
Enter the form name ‘Videos’. Save with F2 and select ‘Form Design’ again, then
‘Modify Existing Form’, and finally ‘Videos’.
Figure 19
Information Systems: Database Systems (H)
53
These are the field definitions (use F10):
Field ‘Title’, Text 30, Mandatory, Indexed, Field
Field ‘VideoNo’, Integer 6, Mandatory, Unique, Indexed, Field
Field ‘HirePrice’, Fixed point 5, Mandatory, Indexed, Field
Field ‘Certificate’, Text 6, Mandatory, Indexed, Field
Field ‘Category’, Text 20, Mandatory, Indexed, Field
Field ‘Available’, Text 4, Mandatory, Field
Field ‘StarName’, Text 25, Indexed, Field
Now save the definitions, return to main menu, and select ‘Data Entry’. Enter this
data, revised from Figure 8:
Lion King The, 12, 2.00, U, Family, No
Spice World, 21, 2.00, U, Family, Yes, Spice Girls
Patriot Games, 17, 1.50, 12, Action/Adventure, Yes, Harrison Ford
Independence Day, 11, 2.00, 12, SciFi/Fantasy, No
Forrest Gump, 6, 1.50, U, Comedy, Yes, Tom Hanks
Contact, 3, 3.00, 12, SciFi/Fantasy, No, Jodie Foster
Abyss The, 1, 2.00, 12, SciFi/Fantasy, Yes, Ed Harris
Hunchback of Notre Dame The, 10, 2.00, U, Family, Yes
G I Jane, 8, 2.50, 18, Action/Adventure, No, Demi Moore
Nixon, 16, 2.00, 15, Drama, yes, Anthony Hopkins
Titanic The, 23, 3.00, 12, Drama, No, Kate Winslet
Michael Collins, 13, 2.50, 18, Drama, No, Liam Neeson
Starship Troopers, 22, 3.00, 12, SciFi/Fantasy, No
Full Monty The, 7, 3.00, 15, Comedy, No, Robert Carlisle
Mission Impossible, 14, 2.50, 15, Action/Adventure, No, Tom Cruise
Net The, 15, 2.00, 2.00, 12, Mystery/Thriller, No, Sandra Bullock
Down Periscope, 5, 2.00, PG, Comedy, Yes, Kelsey Grammer
Crash, 4, 3.00, 18, Horror, No
Police Academy 6, 18, 1.50, 18, Comedy, Yes
Vampire in Brooklyn, 25, 2.00, 18, Horror, No, Eddie Murphy
True Lies, 24, 1.50, 12, Action/Adventure, No, Arnold Schwarzenegger
Ransom, 19, 2.50, 15, Mystery/Thriller, No, Mel Gibson
Hackers, 9, 2.00, 12, Action/Adventure, No
Species, 20, 1.50, 18, SciFi/Fantasy, Yes
Batman and Robin, 2, 2.00, 12, SciFi/Fantasy, No, Val Kilmer
Save with F2, edit if necessary, and save again. You should now have two forms
‘Members’ and ‘Videos’ in the database ‘KornerMM’.
Next you’re going to create a new form called ‘Transacts’ which will have linkups
(relationships) with both ‘Members’ and ‘Videos’. Look at Figure 20.
Information Systems: Database Systems (H)
54
Figure 20
On the main menu select ‘Design Form’, then ‘Copy Existing Form’, selecting the
name ‘Template’. Now give it the new form name ‘Transacts’.
On line 3, column 5, enter the words ‘Video Number’, which is the first field. Press
F10 to define the field, and enter these details;
Field Name
Field Data Type
Field Length
Is Entry Mandatory
Is this the Unique Field
Index this Field
Allow User Entry
Display Contents as
Is the Field Derived
VideoNo
Integer
6
Yes
Yes
Yes
Yes
Field
No
Press F2 to save the definition. Then enter field names as in the layout on Figure 20,
and these corresponding field definitions:
MemberNo, Integer 6, Mandatory, Indexed, Field
Title, Text 30, Field, Derived
HirePrice, Fixed point 8, Field, Derived
Name, Text 40, Field, Derived
DateIssue, Date 9, Mandatory, Indexed, Field
CreditLimit, Fixed point 8, Field, Derived
Returned, Text 5, Field
TransactNo, Integer 6,Mandatory, Indexed, Field
Now save the definitions, and the form.
Information Systems: Database Systems (H)
55
Relationships and the Lookup function
We are now going to use previously entered data by means of Easy Base’s lookup
function, together with pre-recorded relationship links. This is a most important
feature of any Database Management System (DBMS). The items to be looked up are
‘Title’, ‘HirePrice’, ‘Name’, and ‘CreditLimit’, which were previously stored in the
‘Members’ and ‘Videos’ forms; notice that the four items have ‘Derived’ as part of
their field definition.
The principle of this is simple: the items have been already recorded, and do not have
to be recorded again. All we have to do is tell Easy Base where they are stored, and
ask it to copy them automatically to the ‘Transacts’ form. We also have to tell it the
unique fields in this case, which are ‘MemberNo’ and ‘VideoNo’; notice that these
names are exactly the same in both forms.
On the main menu, select Option 3, ‘Relationships’. There are five fields to be filled,
the first of which is ‘Primary Form’. Select ‘Transacts’, the destination form. In the
second field, ‘Secondary Form’, select ‘Members’, the source form. Notice that you
cannot enter these freehand, but only from a supplied list of forms; this is part of Easy
Base’s internal verification of data.
The next two fields record the linking fields in the primary and secondary forms;
select ‘MemberNo’ for both. The last field has a default relationship name (the
primary form) which you can leave.
Save these choices, return to Form Design and load your ‘Transacts’ form. Now you
have to edit the definitions of the ‘Name’ and ‘Credit Limit’ fields. Select the ‘Name’
field first, and press F10. Now set the ‘Derived’ item to ‘Yes’, and in its window,
enter the following:
Lookup(members, name)
Press F2 to save, and select the ‘CreditLimit’ field. Enter this derivation:
Lookup(members, creditlimit)
To test whether this is working or not, press F5. Enter a member’s number in the
‘MemberNo’ field, press Return, and you should see the details appear on the ‘Name’
and ‘CreditLimit’ fields.
Now you have to do the same thing again for a linkup between the ‘Transacts’ and
‘Videos’ forms. Select ‘Relationships’ on the main menu, and enter the following
details:
Primary Form
Secondary Form
Related Fields
Relationship Name
Transacts
Videos
VideoNo (both)
Videos
Information Systems: Database Systems (H)
56
Save these, and return to your ‘Transacts’ form in Form Design. Edit your derivations
of ‘Title’ and ‘Hire Price’ as follows:
Title
HirePrice
Lookup(videos, title)
Lookup(videos, hireprice)
Save these changes, and test your linkups by loading ‘Transacts’ in Data Entry. Enter
a member’s number and a video number, and the four item details should appear. If
they don’t, revise your definitions, especially the derivations, and check that your
unique field names are the same in both forms.
Get a printout of your results, using F11. (See Figure 21)
Figure 21
Information Systems: Database Systems (H)
57
Task 28
28.1 Look at Figure 22. You have to design and implement a form called ‘Invoices’
which will have linkups (relationships) with the ‘Members’ and ‘Videos’ forms.
Use the template to design a layout, which need not be exactly the same as
Figure 21, but must hold the same information. There are twelve fields and all
must be included.
28.2 Start with Form Design and make your field definitions. Decide which of the
fields are derived, and create suitable derivations as required.
28.3 Implement your design by providing suitable linkups between the forms, and
test it.
28.4 Get printouts (screen displays) of two sets of test data.
28.5 Write a report containing details of: screen layout, field definitions, derivations,
and linkups. Finally give an assessment of the extent to which you have
achieved the aims as set out in 28.1.
Figure 22
Making a report
Procedures
By ‘report’, we mean a selection of data from a database; for example, a number of
fields can be selected, and arranged in a particular way, with headings. In order to do
this in Easy Base, we use procedures, which are sets of instructions for precisely this
purpose. They consist of a code which is similar to the Basic programming language,
but which is easily understood. They are in two parts, a procedure code, which
contains your instructions to Easy Base as to what you want done, and an output
format, which tells Easy Base how you want your output display, whether to screen or
printer, to look. An input screen is also required, when you want variables for
example to be defined.
Select ‘Procedures’ from the main menu, and Option 1, ‘Create New Procedure’. To
the prompt ‘save untitled?’, enter ‘Yes’, then enter the new name ‘Video List’. Now
select ‘Create Procedure Code’, press F1, and select ‘Declare Output Fields’. Select
Information Systems: Database Systems (H)
58
‘Videos’, and then the three fields, ‘title’, ‘certificate’, and ‘category’; use a colon as a
separator. Alternatively, you can type this in by hand. This how the finished
procedure looks:
Declare output fields
Videos.title : Videos.certificate : Videos.category
End
Save immediately with F2. Easy Base is being asked to display three fields from the
‘Videos’ form, the title, certificate, and category. Now complete your procedure code
as follows:
Declare output fields
Videos.title : Videos.certificate : Videos.category
End
for Videos
Print list items
next
Press F2 to check and save the code. In case of error, check the code with ‘Modify
Procedure Code’ and save again.
The procedure will not run yet, as you will find out if you select Option 6, ‘Run
Procedure’. We still have to tell Easy base how the records are to be arranged and
whether they are to be displayed on screen or printed.
Select Option 5, ‘Create Output Format’, and from the sub-menu ‘List Items’. On the
second line, move the cursor along four spaces, and press F10. Select ‘Videos.title’,
set the data type to ‘Text’, the field length to 30, and press F2. The entry, ‘Trim
Trailing Spaces’, which is concerned with blanks at the beginning or end of a line,
should be left at the default setting of ‘No’.
Move the cursor along to the end of the field block, plus one, then press F10 again.
Select ‘Videos.certificate’; its settings should be Text, 6, No. Save the settings with
F2. Move the cursor along to the end of the field block, plus one, and press F10.
Select ‘Videos.category’, with settings of Text, 20, No. Once again, save these
settings. Now press the Return key and type a full stop. On the sub-menu, select
‘End’. Save this format. Another menu will appear, and you should select ‘Output to
Screen’. Now save your whole procedure by selecting Option 7 on the Procedures
menu.
Now select Option 6, ‘Run Procedure’. You should see the three fields listed down
the screen; use PageDown to see the rest of the list.
Information Systems: Database Systems (H)
59
For special print effects select ‘Modify Procedure Code’ and make the following
changes:
Declare output fields
Videos.title : Videos.certificate : Videos.category
End
Bold on
12 CPI
for videos
print list items
next
Save the format and the procedure, and select ‘Modify Output Format’. When you
press F2 to save it, select ‘Choose at Run Time’. Now save the procedure and when
you run it, select the printer. If you have done everything correctly, you should have a
printout in bold at 12 characters to the inch.
We have obtained a list of the videos in order of entry, but it would be much better if
we could re-arrange them in order, say, of ‘Title’ or ‘Category’ as in Figure 23. To
do this, edit the procedure code as follows:
for videos with category in order
Figure 23
Information Systems: Database Systems (H)
60
Save the code and the procedure, then run it and print. The categories will now be in
alphabetical order.
Task 29
29.1 Edit the procedure code so that a) the titles b) the certificates are in order (it will
cope with the combination of letters and numbers).
29.2 Take off the bold effect, and print out the results in ordinary draft print.
The output would be improved considerably if the categories were in separate sections
with a header. To achieve this, edit the procedure code as follows:
Declare output fields
videos.title : videos.certificate : videos.category
end
declare variables
lastcategory as text
end
for videos with category in order
if videos.category <> lastcategory then print group header
lastcategory = videos.category
print list items
next
‘Lastcategory’ is a text variable. During the ‘For…next’ loop the list items will be
printed on each loop but the group header will only be printed when the category
changes.
The output format needs editing, as follows:
.group header
███████████
.list items
████████████
.end
████████████
The group header contains the ‘category’ field, while the list items are ‘title’ and
‘certificate’.
The result is as follows:
Action/Adventure
Patriot Games
GI Jane
Mission Impossible
True Lies
12
18
15
12
Information Systems: Database Systems (H)
61
Comedy
Forrest Gump
Full Monty, the
Down Periscope
Police Academy 6
U
15
PG
18
Drama
Nixon
And so on..
15
Bold and underline can be added to the group header by inserting effects commands
inside the ‘if’ statement, as follows:
for videos with category in order
if videos.category <> lastcategory then
bold on : underline on
print group header
bold off : underline off
end if
print list items
next
Task 30
30.1 Get printouts of the video list arranged in order of category with group headers
as described above a) with b) without the group headers in bold and underline.
30.2 Devise the procedure code and output format for the following:
 four fields to be output: title, certificate, hire price, and star name
 ‘certificate’ to be the group header, and in order
 the group header to be in bold and underline
 layout as follows:
12
Patriot Games
Independence Day
Contact
And so on..
1.50
2.00
3.00
Harrison Ford
Jodie Foster
Task 31
31.1 Load your ‘Members’ form. Create a procedure called ‘Member List’ arranged
in order of surname, and with the following fields to be output: forename,
surname, address1, address2, city, and postcode.
31.2 Modify your ‘Member List’ procedure so that ‘City’ is the group header and
underlined, and the following fields are listed: forename, surname, address1 and
address2.
Final presentation
Information Systems: Database Systems (H)
62
Here is a way to improve the overall presentation of the report. The procedure below
will a) add a heading and b) add a page number as a footer.
Declare output fields
Videos.title : Videos.price : Videos.certificate : Videos.category :
Videos.starname
page number
‘New Field
end
Declare variables
lastcategory as text
end
bold on
print report header
for videos with category in order
sif bottom margin < 1 then
bold on : print page footer
page feed : print page header : bold off
end if
if videos.category <> lastcategory then
underline on
print group header
underline off
end if
print list items
next
print report footer
Now edit the output format to:
.Report Header
VIDEO LIST BY CATEGORY
.Group Header
██████████████
.List Items
███████████████████ ████ ████
█████████████████
.Page Header
Video List by Category (Contd)
.Page Footer
- ██ .Report Footer
.End
Information Systems: Database Systems (H)
63
Search facilities
There are two ways of searching for information in Easy Base:
1. During data entry, you can use key F3 for various simple searches on screen.
Simply place the cursor in the field block, enter the search item and press F3. Easy
Base will locate immediately all records with that item in that field.
You can also place the cursor in an empty field block during data entry, and press
F3. Easy Base will show in a window all possible entries in that field, and in order,
if the field is indexed. In the ‘Videos’ form, it will show all titles, categories,
certificates, and star names.
2. You can enter search statements into procedures. For example, if you wanted a list
of all action/adventure videos, you would create a procedure as follows:
Declare output fields
videos.title : videos.certificate : videos.category
end
for videos with category = “Action/Adventure”
print list items
next
Save the procedure, create a suitable output format, and run the procedure.
Task 32
Create a procedure, and output format, for all videos a) with certificate 12 b) that are
available c) cost £2.00 and d) that are Science Fiction/ Fantasy. Print out the title,
cost, certificate, category, and star in each case.
Membership transactions
The owner of any business whose records are computerised must control access to
everyday transactions such as adding a new member or deleting a member from the
list. Also, if a member changes his/her address, the system must be able to cope.
In Easy Base these transactions are done by procedures.
Adding a new member
First, create a new procedure and new input screen. When asked if you want to copy
an existing form, enter ‘Yes’ and give the form name ‘Members’. Save this screen
and select Create Procedure Code. Now enter the following code:
for members new record
copy all from input
next
Save the procedure, giving it the name ‘New member’. Now save it, run the
procedure, and enter new details.
Information Systems: Database Systems (H)
64
Deleting a member
This is more complicated because it involves derivations. Create a new procedure as
above with the same copied input screen from ‘Members’. However this time a new
relationship must be set between this new form and ‘members’, with ‘memberno’ the
linkup. The new form should be called ‘delete member’. The field definitions must
be edited so as to allow the user access to the ‘memberno’ field only. The other fields
you wish to show must be changed as follows:
lookup(members, forename)
lookup(members, surname)
etc.
Save this and enter the code thus:
for members with memberno = input.memberno
delete record
next
Save again, run the procedure and enter the member’s number. To delete the record,
press F2.
Updating a record
The most common change with a member would be the address, but this involves 4
fields: address1, address2, city, and post code. Again create a new input screen for
the procedure, basing it on the ‘delete member’ example and naming it ‘update
records’. Again, a new relationship must be created between the new form and
‘Members’. Each of the four address fields must be derived as follows:
Default(lookup(members,address1)
Default(lookup(members,address2)
etc.
The ‘default’ entry allows editing to be done. Now enter this new code:
for members with memberno = input.memberno
members.address1 = input.address1
update record
next
For the other address fields, simply add them as extra lines. Save this procedure, run
it and enter the member’s number. The record can now be updated.
User Menus
The best environment in which to present your newly created forms and procedures is
a User Menu, which is a form similar to those which you have created already. Select
‘Menus’ from the main menu and enter the following details:
Information Systems: Database Systems (H)
65
Menu Name
Menu Type
Menu Title
No 4
No 5
Members
Normal
Video Club Members List
Run on number key
leave blank
Enter a New Member
Delete Existing Member
Change Members Address
Run Procedure
Run Procedure
Run Procedure
New Member
Delete Member
Update Records
Press F2 to save. Now we’ll create a startup menu, so select a new menu. Enter these
details:
Menu Name
Menu Type
Menu Title
No 4
Enter Password
Main Menu
Normal
-MAIN MENURun on number key
‘Fred’
Members Records
Members Updates
Program Development
Data Entry
User Menu
System Menus
Members
Members
Save with F2 then press Escape all the way back to the DOS prompt. Restart Easy
Base, and enter your new password. You should see your Main Menu and sub-menu
with all its dependent forms and procedures operational.
EXERCISES
Task 33
33.1 Look at Task 26.3 on page 49, and the database structures (tables) which you
have created for the book dealer scenario.
33.2 Using the new User Menu, create a new database called ‘Bookshop’, with
forms called ‘Books’, ‘Customers’, ‘Transacts’, and ‘Invoices’.
33.3 Create a template form, and design a layout for the four forms.
33.4 Create definitions for each field.
33.5 Choose twenty books from your library, and enter the data with fields as per
your table above; the field ‘category’ should have say six or seven possible
entries: biography, thriller, romance, cookery, DIY, western, and science
fiction.
33.6 Create details of ten customers with fields as per table.
33.7 Remember that the ‘Books’ and ‘Customers’ forms must have a unique field.
33.8 Create ‘Transacts’ and ‘Invoices’ forms complete with linkups (relationships)
to the other two forms.
33.9 Create a reporting facility with procedures, which will enable you to print out
lists of title, author, and category in order, as in the previous example with
videos.
33.10 Create a membership update facility, which will enable you to add a customer,
delete a customer, and change a customer’s address.
Information Systems: Database Systems (H)
66
33.11 Finally, present all forms and procedures in a User Menu entitled ‘Hamish Scott
Books’
33.12 Write an appraisal of your work including:
33.13 the problems you encountered and how you overcame them
33.14 an evaluation of to what extent you achieved your aims.
SUMMARY
1. A report is a selection of data which can be manipulated and presented in a
particular way.
2. Reports are done in Easy Base by creating procedures.
3. The report procedures have two parts: a procedure code, and an output format.
4. The report procedure codes are similar to the Basic programming language, and
easily understood.
5. The output format is concerned with the report’s output display, whether to
screen or printer.
6. The three main membership update transactions are:
 adding a new member
 deleting an existing member
 updating a member’s address.
7. User Menus are used in Easy Base to present forms, procedures, and membership
transactions.
Information Systems: Database Systems (H)
67
Information Systems: Database Systems (H)
68
Download