Anda di halaman 1dari 20

Databases and The Internet 

 
 

Book 1 
Database Basics 
S4 Computing Databases & The Internet

Manual Databases

Data and Information

Remember that any fact or figure that is not organised or has no apparent meaning is known as data.

For example the number 393823 could be

 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.

This can be shown as:

Raw Data Processing Information

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.

Examples of manual databases:

 Telephone directory record


 Pupil records stored on paper
 The electoral roll
field
A database is made up of the following components:

File – a collection of records about one topic


Record –all the information about an item
Field – a single piece of information about an item

1
S4 Computing Databases & The Internet

What is an information system?

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.

Examples of manual information systems:

 Newspapers or magazines focussing on a particular topic e.g. stock markets


 Telephone directories of potential customers
 Address books with staff contact details
 Timetables for train routes in Scotland

Advantages of manual information systems:

 You can carry the information with you


 You don’t need any expertise to use the system

A disadvantage of a manual information system is that it can be slow to find the information.

2
S4 Computing Databases & The Internet

Flat File Databases

What is a flat file database?

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.

Examples of electronic databases:

 Online telephone directory e.g.


http://www.bt.com

 School administration system

 Online property search engine e.g.


http://www.aspc.co.uk

What is an electronic information system?

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.

Examples of electronic information systems:

 Internal company directory of email addresses


 Regional library catalogue and booking system

Key advantages of electronic information systems:

 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

Key disadvantages of electronic information systems:

 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

Further advantages / disadvantages of electronic information systems

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:

 compete in any business field


 perform medical research
 book a flight or a holiday
 get an MOT for your car
 send promotional material to potential customers
 order your grocery shopping online

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.

In this example the amount of data to be stored is


small. The stock levels in the supermarket could be
written down on a checklist.

5/8 6/8 7/8

Milk 16 12 4 In this example the amount of data to be stored


Cheese 7 5 3 is very large. This is due to the number of
OJ 4 1 0 customers and orders that are stored in the
electronic information system.
A problem with this system is that managers could
not easily see which customer bought which item, A manager can easily cross reference the files to
so could not send them money off coupons for find out which customers buy the same item
items they regularly buy. regularly, if they pay in cash or by credit card,
etc. This information is very useful.

4
S4 Computing Databases & The Internet

Additional advantages of using electronic information systems are:

 you can locate items of data quickly, cross referencing files


 you can make amendments easily, all occurrences can be changed at once
 data retrieved can be sorted into order quickly
 data analysis can be carried out automatically on search results
 computer reports containing calculations and summaries are produced quickly

Creating an electronic database

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

Field Name Field Type


Name Text
Age Numeric
Date Joined Date
Photo Graphic
Monthly Fee Numeric
Total Paid Calculated

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

Databases and the Law

All data stored in an electronic database is automatically protected by the following laws:

 Data Protection Act


 Computer Misuse Act
 Copyright, Design and Patents Act

Data Protection Act

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

The data user must ensure they:

 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

A data subject has the right to:

 see the data stored about them (if they pay a fee)
 have incorrect data changed

Computer Misuse Act

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:

 Gaining unauthorised access to a computer system


 Making unauthorised changes to a computer system

6
S4 Computing Databases & The Internet

The act states that “unauthorised changes to computer material” includes:

 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

Examples of computer misuse include:

 Hacking – This involves gaining access to computers which you should not have access to and
then changing, deleting or just looking at their files

 Viruses – creating and sending viruses

 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.

Copyright, Designs and Patents 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.

It makes is illegal to attempt to:

 Copy or steal software and software manuals


 Run software on your computer that does not have a license
 Use the Internet to upload or download software which you do not own

If found guilty of an offence under the Copyright, Designs and Patents Act:

 that person can be sent to prison


 the owner of the software/material can sue for compensation

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

Public / Private Information Systems

Private Information Systems

These are information systems that are not for public use.

For example:

 Police National Database


 UK Government Tax Office
 DVLA (Driver and Vehicle Licensing Centre)
 Businesses (Tesco, Marks and Spencer, Topshop, Starbucks)

Public Information Systems

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 

<  Less Than  Field age < 14  Find all the records that have an age less than 


14 

=  Equals  Field age = 14  Find all the records that have an age equal to 


14 

<=  Less than or equal  Field age <=14  Find all the records that have an age less than 


to  or equal to 14 

<>  Not equal to  Field age <> 14  Find all records that have an age that is not 14 

AND  And  Field surname =  Find all records that have the surname smith 


“smith” and field  and an age equal to 14  
age = 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? 
 

Search on field Colour =”Red” AND


Search on field Make =”Ford”
 
 
e.g.  How many girls in sixth year? 
 

Search on field Gender =”F” AND


Search on field Year =”6”

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? 
 

Search on field Colour =”Red” AND


Search on field Make =”Ford” AND
Search on field Registration like “L*”
 

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. 
 

Sort on field Surname ascending


 
 
 
Forename Surname Exam %
Billy Irvine 95
Andrew McKenzie 87
George Law 86
Ian Benholm 84
David Farquhar 77
Scott Simpson 76
 
2. Sort the above list of exam grades to show highest marks first. 
 

Sort on field “Exam %” descending


 
 
Forename Surname Exam %
Ian Shepherd 76
Scott Simpson 76
Jennifer Mackie 73
Gary Kemp 67
Suzanne McGregor 67
Keith Gregory 64
 
 
3. Sort the above list of exam grades to show highest marks first. If pupils have the same mark then they 
should be in alphabetical order. 
 

Sort on field “Exam %” descending AND


Sort on field Surname ascending
 
 

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 
 

Anda mungkin juga menyukai