Book 1
Database Basics
S4 Computing Databases & The Internet
Manual Databases
Remember that any fact or figure that is not organised or has no apparent meaning is known as data.
A phone number
A map reference
A bank account number
An identification number
A code for a padlock
Once data has been processed it becomes information. E.g. Phone number: 393823.
What is a database?
A database is a collection of data about a single subject that is stored in a file. Data can either be stored
on paper or on a computer. A database that is stored on paper is known as a manual database.
1
S4 Computing Databases & The Internet
Just as information is defined as data which has been processed, an information system can be
described as a database or number of databases which are used be a company or individual to help
them make decisions. An information system that is stored on paper or card is known as a manual
information system.
A disadvantage of a manual information system is that it can be slow to find the information.
2
S4 Computing Databases & The Internet
A database which is on a computer system is an electronic database. Simple electronic databases which
only contain one table in a single file are called flat file databases.
An electronic information system is on a computer and stored on a backing storage device. People
need to be able to use the computer system to access the information.
It is quicker to search and therefore more efficient to use than a manual system
You can store more information in a smaller physical space
You need to know how to use the computer system that contains the information
You need to have a computer system
3
S4 Computing Databases & The Internet
Computerised databases have fundamentally changed the way in which many organisations work.
Businesses or individuals now need to make use of a number of electronic databases to be able to:
The databases which support these electronic information systems are usually very large.
e.g. The information system used by the Driver and Vehicle Licensing Agency (DVLA) stores records
on around 40 million drivers and 30 million vehicles in the UK.
In the past manual databases worked well when the amount of data to be stored was small. Severe
problems arose when users needed to cross reference files. Electronic information systems solve these
problems.
Comparison: Grocery Shopping
Manual Online
You go to a supermarket with a list of items to buy. You visit the supermarket’s website and choose
If the item is not in stock you might decide to go to from a database of available items. You then
another supermarket or shop later to buy it. You enter your payment details and finally your
are responsible for taking the items off the delivery address.
shelves, paying for them and delivering the items
to your home.
4
S4 Computing Databases & The Internet
It is much easier to create a manual database as you do not have to worry about choosing field types. A
field type is the classification of a single piece of information in a record. As each character of text in a
computer system generally takes up 1 byte of storage space, field types are used to ensure that memory
is not wasted when storing other types of information such as numbers or images.
The key field types you should consider when creating your electronic database are:
Text
Numeric
Date
Time
Graphic
Calculated
Below is an example of a manual database record ... and the corresponding design
There are also more advanced field types which can be used:
Object - Suitable for all types of media including sound files, video and graphics
Link – Suitable for storing hyperlinks or URLs (web site addresses) up to 64000 characters long
Boolean – Holds the value true or false only
5
S4 Computing Databases & The Internet
All data stored in an electronic database is automatically protected by the following laws:
If you are storing details about a person (or they are storing your details) then you need to be aware of
the Data Protection Act.
Data user – the person or company storing the data e.g. the school office
Data subject – the person who the data is about e.g. a pupil who has just joined the school
are registered to hold data don’t keep data longer than necessary
collect and use data legally give data subjects access to the
only hold data for the purpose information stored about them
required keep data secure
keep data up to date
see the data stored about them (if they pay a fee)
have incorrect data changed
This act covers the use of computers to commit a crime, unauthorised access to computer material and
spreading viruses over the computer.
The following acts are an offence under the Computer Misuse Act:
6
S4 Computing Databases & The Internet
Interfering with a computer system so it does not run properly e.g. changing hardware settings
Making changes to the system to prevent others accessing it e.g. changing a password
Making changes to the software stored on a computer system e.g. removing a program
Hacking – This involves gaining access to computers which you should not have access to and
then changing, deleting or just looking at their files
Electronic Fraud – This could involve using the computer to transfer money from a bank account
into your own account
With regard to electronic databases, hacking into a computer system to see or alter information or
transmitting a virus to destroy data would be an offence under the Computer Misuse Act.
This act was introduced to try and protect companies and individuals whose work was being copied.
This work includes text, graphics, video and sound files.
The also covers computer software, it means that it is illegal to copy software until 50 years after the
software was published.
If found guilty of an offence under the Copyright, Designs and Patents Act:
It is not just games and software packages that are protected by this law. If a database is stolen, copied
or uploaded to the Internet without permission from the copyright owner (the person who created the
database) that would be an offence under the Copyright, Design and Patents Act.
7
S4 Computing Databases & The Internet
These are information systems that are not for public use.
For example:
These are systems created for the public to help them find useful information.
For example:
Library Catalogue
Newspapers
Telephone Directories
Train, Bus and Airline Timetables
Media (teletext, news websites)
The key difference between private and public systems is everyone can access public systems whereas
access to private systems is limited. This is because if some of the information from a private system was
available to everyone it might be a threat to local or national security, or to a business’ profits.
8
S4 Computing Databases & The Internet
Forms
In business nearly all data entry, editing and deleting operations are carried out via forms.
A form allows you to view and edit data from your database in a slightly different format. Forms are
more pleasing to look at and easier to use.
The easier it is to enter data into a database, the less likely it is mistakes will be made.
A form normally displays one record on screen at a time.
Levels of access can be assigned to a form e.g. the whole form can be made read‐only or only certain
text boxes can be made read‐only. This will stop data being changed by people who are not authorised
to edit the database.
11
S4 Computing Databases & The Internet
Good Form Design Tips
To make your database forms as user‐friendly as possible you should apply as many of the tips listed
below to your form design.
F Keep fonts and colours consistent
O Place the fields in a logical order
R Only include relevant fields that you want the
user to complete
M Meaningful instructions on the form helps your
users
S Use white space to make it easy to understand
and navigate
Good form design will reduce the number
of problems database users have adjusting
from a manual database system to an
electronic database system.
It enhances the user experience.
12
S4 Computing Databases & The Internet
Searching
Simple search vs Complex search
Searching or Querying the database is used to find information. There are two types of searching:
Simple Search Complex Search
There is one criteria/ search term e.g. “Carter” in the There is two or more criteria / search terms e.g. “
surname field Carter” in the surname field and 26 in the age field
Operators
Operators that can be used for searching:
Operator Meaning Example Result
> Greater than Field age > 14 Find all the records that have an age more
than 14
11
S4 Computing Databases & The Internet
Queries
When you need to find a particular piece of data in your database you have to create a Query. You must
enter key words in to the query window, and then the database software will SEARCH your database to
find the data asked for.
e.g. What is the phone number for the Smash Hitters Volleyball team?
Search on Team Name for the data = “Smash Hitters”
The result of the search is then displayed in an answer table.
This is an example of a simple query, since we are using only one field in the search.
A complex query would require input under more than one field heading, and could also use more than
one table in a database.
e.g. How many red ford cars are there in stock?
12
S4 Computing Databases & The Internet
Wildcards
A wildcard is a symbol which is used to stand for one or more character in the search condition. This is
useful if the words you are looking for might be in the middle of a list, or you are not sure of the exact
spelling of a surname. You do not use the = sign in the search criteria unless you know exactly what you
are searching for.
Character Description Example Result
* matches any number of like “wh*” what, where, when, white, etc
characters
like “*beach*” sandy beach, beach nearby, etc
? matches any single b?ll bill, ball, bull, bell
character
[ ] matches any single b[ae]ll ball, bell (not bill or bull)
character within the []
! matches any single b[!ae]ll bill, bull
character not in the []
‐ matches any one of a b[a‐c]d bad, bbd, bcd
range of characters
~ matches any single 1#3 103, 113, 123, 133, etc
numeric character
An example of a complex search using wildcards would be:
How many red Ford cars which have the registration letter L are there?
13
S4 Computing Databases & The Internet
Sorting
Simple sort v Complex sort
There are two types of sort in a database:
Simple Sort – data in the database is sorted on Complex Sort – the data in the database is sorted
one field. on two or more fields.
(in the example above sorted by age) (in the example above sorted by surname, then age)
Once you have successfully queried the database it is often useful to arrange the information in some
kind of order. A sorting operation is performed to achieve this.
Ascending Order
Ascending order is when the information is sorted from smallest to biggest, in the
case of numbers, or from letter A to letter Z.
Descending Order
Descending order is when the information is sorted from biggest to smallest, in the
case of numbers, or from letter Z to letter A.
14
S4 Computing Databases & The Internet
Sorting: Examples
Forename Surname Year
Billy McPherson 1
David Farquhar 1
Billy Irvine 1
Ian Benholm 1
Ian Shepherd 1
1. Sort the above list of first year pupils alphabetically.
15
S4 Computing Databases & The Internet
Reports
Types of report
Reports are then used to display tables or results from queries in a more attractive manner.
The two main report types are:
CARD FORMAT LIST FORMAT
• Single record per section / page • Multiple records per section / page
• Looks like a database form • Looks like a database table
A report is like a query in that it can summarise the data in a database.
The key difference is that reports are used to produce printed output, not just find the answer.
16
S4 Computing Databases & The Internet
Creating simple reports
The Microsoft Access report generator allows control over layout, shadings, fonts, styles, sizes and page
breaks. You can also:
• Organise and present your data in groups
• Calculate running totals, group totals and percentages of totals
• Include sub reports and graphs
• Design an attractive presentation format with pictures, lines and special fonts.
A report is made up of various sections, with each one having a specific purpose.
Report header/footer:
contains information such
as the title, author and
date
Detail section: contains
the main body of the
report
Page header/footer:
contains information such
as column headings and
page numbers
Each report section can be resized as necessary. You should always take care to ensure that title and
data boxes are in line.
17
S4 Computing Databases & The Internet
Keys
If databases have not been set up correctly problems can occur later down the line.
Take this class database for example:
Forename Surname Year
Billy McPherson 1
David Farquhar 1
Billy Irvine 1
Ian Benholm 1
Ian Shepherd 1
If a new pupil, also called Billy Irvine, joins the class this could cause problems with existing queries and
reports.
Primary Key
When designing your database it is easier to find records if you use a primary key.
These are unique values that identify each individual record.
Pupil ID Forename Surname Year
001 Billy McPherson 1
021 David Farquhar 1
291 Billy Irvine 1
054 Ian Benholm 1
199 Ian Shepherd 1
You do not always have to create a new database field, you can use existing fields as primary keys too.
Numeric IDs
are the best choice of keys
18
S4 Computing Databases & The Internet
Validation
Validation checks are used to try and ensure that only suitable data is entered into the database.
There are three types of validation check:
• Presence Check
• Range Check
• Restricted Choice
Presence Check
Presence check validation sets whether or not a field can be left blank or not.
For example: Pupils registered with the SQA to sit their exams all must have a Scottish Candidate
Number.
If a presence check is set on this field any attempt to leave the SCN entry blank will cause an error
message to appear.
Restricted Choice
Restricted choice validation limits the data that can be entered into a field to a list of values.
When designing this you must list the acceptable values. (e.g. Computing, English, Maths)
For example: Pupils choosing subjects for column E will only have a certain list of subject options.
If a user attempts to enter any other subject name an error message will usually appear (although
advanced database users can change this setting).
Range Check
Range check validation ensures that the numeric data entered is within a certain range of values.
When designing this you must state the acceptable range of values. (e.g. >=12 and <=18)
For example: Pupils at secondary school who want to play for the under 18 football team must be under
18 years old but over 12.
If a user attempts to enter any number outside the acceptable range an error message will appear.
19