Академический Документы
Профессиональный Документы
Культура Документы
databases
Reference document
Document information
Related documentation
Other related documents are available from the web at:
www.bristol.ac.uk/is/learning/documentation/docs-by-category.html#db
Introduction
Access is the University's recommended database product for Windows on PCs. Access
2000 / 2002 (XP) is supported by the Computer Centre. This document provides an
introduction to database concepts and introduces basic relational database design
techniques. Used with the document Using and designing Access databases (document
number acc-t6) it will enable you to:
• explain what a database is;
• recognise and apply different data types to data;
• identify the appropriate software to use;
• design a simple relational database structure.
The two exercises in this document would be done as a practical group exercise after Task
2 in the document Using and designing Access databases (document number acc-t6).
Prerequisites
Before attending the Access course you must be familiar with Windows - if you are not,
please first attend the Information Services course Getting started with PCs (code
CC1GPC). Experience of Word or Excel is desirable.
Getting started with databases (acc-r1)
Contents
Document information
1. What is database?.........................................................................................1
2. Data Protection Act .......................................................................................2
3. Database Jargon ...........................................................................................3
4. What software should I use? .......................................................................3
Word .................................................................................................. 3
Excel .................................................................................................. 3
Access ............................................................................................... 3
Oracle ................................................................................................ 3
EndNote ............................................................................................. 3
SPSS .................................................................................................. 3
5. Designing a database ...................................................................................3
What is a data type? ......................................................................... 3
Exercise 1. Design a cinema table ...................................................................... 3
6. Designing a relational database ..................................................................3
Relationships .................................................................................... 3
Indexes .............................................................................................. 3
The primary key ................................................................................ 3
Exercise 2. Create a library database ................................................................. 3
Getting started with databases (acc-r1)
1. What is database?
Database programs such as Access (sometimes called Relational Database
Management systems or RDBMS) are used to store information, often large amounts
of information. The information held in a database may be, eg:
• Simple names, addresses and telephone numbers - excellent for mail-merging
letters and labels.
• Bookings (eg, courses, conferences, residential).
• Equipment/maintenance records.
• Admissions data (available from the Computer Centre).
• Undergraduate, postgraduate and past student data (current student data
available from the Computer Centre. The Alumni Office can provide past
student data, and the Careers Service can provide employment details of past
students).
• Finance data.
• Staff data.
• Library catalogues (books and periodicals).
• Dictionaries.
• Research data (eg, medical, scientific, engineering, social science).
• Bibliographic/Reference data (using Papyrus - a bibliography management
package).
• Sound/video clips.
• CD-ROM databases.
If you wish to set up a database that contains University administrative data (eg,
Finance, Admissions, Personnel, Student, or Corporate literature) contact Information
Services as they may be able to help you to link into an existing database.
1
Getting started with databases (acc-r1)
2
Getting started with databases (acc-r1)
3. Database Jargon
Primary key A way of uniquely identifying a record eg, National Insurance number,
student number.
Object An identifiable unit such as a table, form report or control that you can
select and manipulate as a unit.
Table An object that stores data in rows (records) and columns (fields). The
data is usually about a particular subject.
Form An object you can use to enter, change and view records of data. You
can use a form to display records on the screen or in print.
Query An object that asks a question or defines a set of criteria about data
from your tables.
Report An object you can use to print records in a custom layout. You can use
a report to group records and show totals for groups and grand totals
for the entire report.
Macro A list of actions you want the database software to carry out for you.
Integrity Ensuring the information being entered into one table is compatible with
information in related tables and ensuring that information is not
deleted from one table where other tables are dependent upon it.
3
Getting started with databases (acc-r1)
4
Getting started with databases (acc-r1)
Oracle
Oracle is a very comprehensive relational database management system. It is
recommended if either large datasets or complex data are needed. The standard
query language SQL is used to interact with the database. Oracle is not
recommended for small databases or for users without relational database experience.
The University's large administrative databases run under Oracle (eg, staff, student
and admissions data). Help from the Computer Centre will almost certainly be
necessary to design or use an Oracle database.
EndNote
EndNote is a bibliography management package. EndNote stores references in a
database. It can search the database to locate the references needed for a particular
bibliography and can produce the bibliography in the style required by a particular
publisher, journal editor, or institution. It can also scan the text of an article or thesis
for citations and generate the corresponding bibliography. EndNote is of most benefit
to academic staff and research students. Check the info on:
www.bristol.ac.uk/is/computing/advice/software/swprice2.htm#endnote
Many departments subscribe to a scheme whereby all their department-owned PCs
and Macs may have perpetual copies of EndNote installed at no extra cost. A list of
these is available but please check with your Departmental Computing Support Staff
for the latest situation. If your department does not subscribe to this scheme then
department-owned single-PC perpetual copies may be bought for £140 via
departmental purchase orders sent to Alan Blackman, Alan.Blackman@bristol.ac.uk.
SPSS
SPSS is a suite of products for statistical analysis and data management that enables
analysts and researchers to access, prepare, manage, analyse, and report on data in
order to solve business and research problems throughout the entire analytical
process.
SPSS can either be installed on a Windows PC or run from the Unix machine ISIS.
The price for the new Windows 'single copy licence' is £70 per annum. There is also a
special "departmental site licence" available at £500 per annum. The deal finishes in
November, 2007. Contact George Gooding, George.Gooding@bristol.ac.uk if you
wish to purchase.
5
Getting started with databases (acc-r1)
5. Designing a database
Before you sit at your PC to create a database you need to think about the most
efficient and convenient way to store the information so that it can be retrieved in the
format required. Although a database definition can be changed after it has been
created, it is much easier to get it right to begin with. Points to consider are:
• The names of your database, tables, forms, queries and reports. Like any other
names, they should reflect the information they contain.
• The way in which you wish to store the information. For example, names of
people should have at least three fields - title, initials and last name - to give
maximum flexibility in using the data; similarly, addresses normally require at
least six fields, for building/house name, street, town, county, postcode and
country (if appropriate).
• The number of tables and fields you require and how the tables might be linked.
Try to think of all the information you might want to get out of the database.
• The names of the fields. These may be up to 64 characters in length, but about
15 is a more normal size to avoid repercussions on default forms and reports
etc. You can use A-Z and 0-9 in your field names but are advised to avoid using
spaces, *, ? or other symbols. Use underscores if you wish to separate field
names. Try to choose sensible names which are self-explanatory.
• The design of forms. If the information is being taken from, eg, a paper form, it
is more efficient to design your on-line form so that the information is entered in
the same order as it is read from the paper form.
• The size of the fields. For example, you might choose a field size of 8 for a text
field that stores eight character codes. That way you can't accidentally enter
more than eight characters in the field.
Warning! If you reduce the size of text fields in tables that already contain data, characters that
no longer fit in the field are lost.
6
Getting started with databases (acc-r1)
If you are uncertain about how to design your database, you can look at the sample
databases which come with Access to give you some ideas. Alternatively, you can
contact the Computer Centre for advice, preferably before you start collecting any data
or transferring data from another package.
7
Getting started with databases (acc-r1)
You will need to determine the names, size and types of fields, eg,
Field name Data type Size / format
Surname Text 25
DOB Date Short date
and
time
8
Getting started with databases (acc-r1)
9
Getting started with databases (acc-r1)
One-to-one relationships
In a one-to-one relationship, each record in the primary table can be associated with
only one record in the related table. In this case the related fields must be the primary
keys of both tables. This type of relationship has more limited use. One example
would be Personnel records. This information could be split into two tables, linked by
the staff number. Information contained in one table could be on open access to all
staff whereas the other table may contain confidential information which could only be
accessed by Personnel staff.
It is best to set up any relationships before creating forms, queries or reports so that
the relationships are automatically built into forms and queries created thereafter.
Indexes
Databases use indexes in tables as you would use an index to a book: to find data, it
looks up the location of the data in the index. Adding indexes to fields within your
database which frequently have a condition set on them speed up searches and
queries but may cause delays when making changes to data. This is because
databases must update indexes in a table each time a record is added or changed. It
is only necessary to create indexes if you have a large database and you find that
performance time on queries is slow. With most databases, it is possible to create
multiple field indexes (eg, Surname plus Forenames).
The primary key
The primary key is an important aspect of a relational database. The primary key is
an index where no duplicates and no blank fields are allowed, ie it must be unique to a
particular record. Surnames or course codes could not be primary key fields as it is
likely that there will be several Smiths or students on the same course in the database.
Good primary key fields are student numbers, order numbers etc.
The primary key doesn't have to be a single field. It can be formed from several fields
whose values together uniquely identify a single record. There can be only one
primary key index per table. The primary key is particularly important when creating
relationships between tables.
10
Getting started with databases (acc-r1)
You may use as many tables as you like. Plot out the relationships as in the cinema
diagram on page 3.
Hint:
You will need at least three tables but for efficiency, yet still keeping the design fairly
simple, you could use five.
11