Unit 4 - Introduction To Databases
Unit 4 - Introduction To Databases
4
Introduction to Databases
Source: http://tinyurl.com/o77ysht
Overview
Despite all of these merits Spreadsheets are not a suitable solution for all situations
involving the management of business data. Spreadsheets are not the most effective
tool for situations requiring the capture, storage, organisation and management
of complex sets of business data and records, especially those records that may be
interrelated in some way. Further, Spreadsheets do not naturally offer simultaneous
Further, Spreadsheets do not offer a robust platform for the capture, organisation and
management of complex business data and records. They do not offer sufficiently
thorough mechanisms for ensuring that data is captured and added to the software
in a secure way that preserves the integrity of the data being entered. Spreadsheets
also do not offer significant granular mechanisms for restricting or allowing users to
view, interact with, interrogate and use portions of the data available. For situations
requiring such features the more appropriate option would be a Database.
This unit aims to introduce you to Database concepts, Database design practices
and the potential use of Database solutions in addressing a range of business needs.
Additionally, this unit will introduce you to one of the most accessible implementations
of a Database environment, Microsoft Access. Leveraging these database concepts,
practices and software features will allow you to design and develop Database solutions
suitable for addressing long term business management needs. Throughout the unit
you will be expected to participate in a series of tutorials and hands-on exercises
covering the application of database concepts, practices and software features within
a business context.
Session 4.3: Creating and Using Relational Databases to Solve Business Problems
and Enhance Decision Making
Required Resources
Miller, Lisa. (2008). MIS Cases: Decision making with application software (3rd
Edition). Pearson Education Inc., Upper Saddle River, New Jersey
Additional Resources
Donalds, C. and Henry, J., Solving managerial problems with spreadsheets and
databases, 2011.
Introduction
To be able to design, develop and use databases to solve business problems or
satisfy business needs one must understand basic Database concepts and terms. This
session will introduce you to Database concepts, terminology and associated design
considerations and practices. Throughout the activities and exercises found within the
session you will learn to use such concepts and practices to analyse business cases and
apply good design techniques when developing database models.
Database
First, what does the term Database mean? A Database is an organised collection of data,
facts or information about places, people, events, transactions, things and concepts. A
Database can be a manual paper-based system (for example an address book or library
card catalogue) or a computer-based software system (for example Microsoft Access).
In paper-based implementations this collection of data or facts is organised as records
stored within a filing system, folder, book, card collection or some other recording and
organisation system. Within software systems like Microsoft Access, this collection of
data or facts is organised as records within tables. You may recall from unit 2 that a
record is simply a collection of individual pieces of related data items. Consider an
address book containing the first name, last name, date-of-birth, address and contact
number of an individual.
Knowledge Check
Regardless of the form, manual or computer based, it is important to note that the
records found within a single database should be related in some way. For example,
a single database would not likely be used to store the patient medical history
information for a doctor’s office as well as the customer account information for a
public utility company (for example, electricity, telecommunications or water). These
sets of data are wholly unrelated and should be kept in separate databases.
Complete Learning Activity 4.1 to learn more about relevant database concepts.
ACTIVITY 4.1
Database Concepts (30 minutes)
Instructions:
Task A: Read Chapter 4, Data and Databases in the text at the link below:
Bourgeois, D. (2014). Information systems for Business and Beyond.
Retrieved from
uu http://open.umn.edu/opentextbooks/BookDetail.aspx?bookId=189
While reading, pay particular attention to the sections on Relational
Databases, Primary Keys, Designing a Database and Data Types.
Task B:
In the unit forum, post your thoughts on how databases may prove useful
in the context of your business or job role. Feel free to post questions for
any of the database concepts found within the chapter on which you need
clarification.
The following are a few of the many questions that you may wish to ask during this
step:
• What are the reasons for wanting to have and use the proposed Database?
Having a clear idea of the reason or reasons and the purpose will allow you to design
a Database that is more likely to satisfy the needs of business stakeholders. Consider,
for example, that a business may wish to maintain a list of inventory, distribution
and supplier information for the purposes of managing stock, producing reports on
inventory levels and facilitating the supplier engagement and ordering/reordering
process. This wish may have originated from a problem previously noted by the
business. For example, a business may have experienced lost sales as a result of not
having a given item in stock. In addition to lost income this would likely result in
customer dissatisfaction and may conclude with the customer purchasing the item
from a competitor.
The wish to have a Database may have also arisen from a need derived from a business
strategy or target. For example, a business may have set a goal to surpass last year’s
Mother’s day and Father’s day sales by a minimum of 20%. To do this, the business
may want a facility to extract details of the most popular items from the sales records
from previous periods. Knowing the goal of a Database will help you determine the
type and form of the information the Database must be able to produce as output.
Understanding the information a Database must be able to produce will help you to
determine what pieces of data the Database needs to capture, manage and process in
order to produce the expected output. Such knowledge will also inform other design
and development decisions.
At the very basic level, record and table design involves a few simple tasks:
2. Designing the structure of the record/tables by identifying and naming the fields/
columns.
The examples below show sample records for the Customer – Julia Hanson, the
Customer – Fred Johnson, the Stock item – ABC Brand 8.5 X 11 Inch Printer Paper and
the Payment of $525.00 made on December 3, 2015.
Customer Record
CustomerID: 79019
FirstName: Julia
LastName: Hanson
DateOfBirth: February 2, 1985
Address: 123 Home Street, Dream City
ContactNumber: 62-(781)586-1793
Email: [email protected]
Customer Record
CustomerID: 79020
FirstName: Fred
LastName: Johnson
DateOfBirth: April 15, 1991
Address: 56 Seventh Street, Home City
ContactNumber: 71-(345)531-1357
Email: [email protected]
Stock Record
ItemID: 1234
ItemName: ABC Brand 8.5 X 11 Inch Printer Paper
ItemDescription: 1 Ream (500 sheets) Multipurpose Paper
QuantityInStock: 13
ReorderLevel: 8
MinReorderAmt: 10
Payment Record
PaymentID: 82194
Type: Cash
Amount: $525.00
Date: December 3, 2015
Figure 4.2: Example of Records
Record/Table Design
A table stores all of the records about an entity. Once you have identified what entity
you want to maintain information about the next step is to design a table for each.
Table design begins with selecting an appropriate table name. Tables are usually
named after the entity that it is storing information about. Since the information being
stored relates to a thing of interest, the name of the table or record is often based on a
noun. Note that this is not a mandatory requirement but a common practice.
We have seen earlier examples of records for different entities, such as Customer, Stock
and Payment. In Microsoft Access the convention is to either name tables using the
name of the entity the information relates to OR name tables by using the entity name
appended to a prefix or suffix tbl. This allows you to indicate to any user that you are
referring to a table (as opposed to another Microsoft Access component).
Once you have identified your required tables you should then identify the individual
pieces of data that should be stored within each table. This could be an easy task if you
are simply translating a paper-based record into a Microsoft Access table. The fields of
your paper-based record become the columns of your table. Figure 4.3 and Figure 4.4
below demonstrate such a straightforward table design. Note that in Microsoft Access
the terms field and column are often used interchangeably.
Customer Record
CustomerID: 79019
FirstName: Julia
LastName: Hanson
DateOfBirth: February 2, 1985
Address: 123 Home Street, Dream City
ContactNumber: 62-(781)586-1793
Email: [email protected]
Figure 4.3: Example of paper-based Customer record with fields CustomerID,
FirstName etc.
Some situations are not this straightforward. Sometimes a business has no pre-existing
records about an entity. This requires you to design your records/tables from scratch.
At other times there may be pre-existing records but these records may be in a form
that is not fully suitable for mapping directly into an Access table form.
In performing this design step it is important that you consider any additional data
items or fields that should be captured and maintained. At the very least you should
always ensure that your design includes a field/column that uniquely identifies and
distinguishes each record. In the example above it is possible that two customers may
possess the same name. As such, another field would be needed to uniquely distinguish
one customer from another. In this case that field is CustomerID. You would have had
to add this field if the company did not already maintain this information within their
paper-based records.
Field/Column Names
A field stores a single item of data about an entity. First name, last name, date-of-birth
are each examples of a single item of data about a Customer entity that a business
may want to track. These are the fields of a Customer record. In database design
terminology a field may also be referred to as an attribute of an entity. Very simply
a field is a part of a record. In Microsoft Access these are represented as columns
within a table. Do not let all of these terms confuse you. They all mean the same thing
but arise from different points of view. See the chart below to clarify the names used
for each perspective. In Microsoft Access the terms field and column are often used
interchangeably.
In Microsoft Access the convention is to give a field or column a name that describes
the data that is being stored. So a Customer’s first name may be typically referred to in
Microsoft Access as First Name, FirstName, fName or simply as First. You will notice
in the example records depicted in Figure 4.2 and 4.3 and the table design depicted in
Figure 4.4 above that all field and column names were descriptive and contained no
spaces. This is a common and recommended practice.
• Use short, simple yet meaningful and descriptive names. Table, 1, Table2, Field8
and Field9 are not descriptive names.
• While names can include special characters, it is common practice to use only
alphanumeric characters when naming your fields.
• While names can include a space, this is discouraged. Use the underscore character
(“_”) instead of a space when necessary.
• Tables and fields should always be consistently named. For example in a given
Database one should not find one table named tblCustomer and another table
named Supplier_tbl. In a given table one should not find a field named First and
another named lastName. Consistency includes details of the name and the letter
case (uppercase and lowercase).
One important Field property is the field size property. Note that the value of this
property differs for some types of data. For Text data types this field allows you to
indicate the maximum number of characters that will be allowed/stored within this
space when implemented as a Database software table. This allows you to reduce
hard disk storage requirements by limiting the allocated space to what you think you
would realistically need to represent that real world data within the Database. For an
email address 25-30 characters would most likely be sufficient. Allocating more than
30 characters would result in space being allocated unnecessarily.
There are a number of field properties that you may choose to configure. Field Size,
Format, Input Mask, Caption and Default Value are all examples of field properties.
This topic will be explored in further detail in upcoming units.
Miller, Lisa. (2008). MIS Cases: Decision making with application software
(3rd. Edition). Pearson Education Inc., Upper Saddle River, New Jersey
ACTIVITY 4.4
Database Design (30 minutes)
Instructions:
Task A: Using the help facility of your Microsoft Access software (or any
related online help facility provided by the Microsoft Corporation), locate
and review the guidance provided on database design basics.
Task B:
Proceed to the LE and in the appropriate forum post your thoughts on
how databases may prove useful in the context of your business or job
role. Feel free to post questions on any of the database concepts and
database design recommendations found within the help article that you
need clarified.
In Session 4.1 we explored the basic database concepts and reviewed a number of design
and development practices, conventions and steps. In the next session, we will expand
our examination of database concepts by looking at more complex data management
and organisation requirements, specifically using relationships to capture and model
real world data.
Introduction
Designing a Database to meet the needs of real world data and business situations is
often a challenging endeavour. This is partially due to the fact that business data is
rarely found to be in a simple standalone form. More often than not such data is messy,
complex and interrelated. In this session you will learn to recognise relationships in
real world data and apply good design techniques when developing database models
for such complex and interrelated real world data and business situations.
Now suppose you intend to design and develop a Database for an online retailer to
manage customer, order, payment and stock details. Examination of the business
processes would undoubtedly lead you to create tables for Customer, Order, Payment
and Product Records. Let us consider a purchase made by Customer Julia Hanson and
take a closer look at two of the records and tables that would have been involved in
the purchase, Customer and Payment. These are depicted within Figure 4.5 and Figure
4.6 below.
Customer
CustomerID FirstName LastName DateOfBirth Address ContactNumber Email
Payment Record
PaymentID: 82194
Type: Cash
Amount: $525.00
Date: December 3, 2015
Payment
PaymentID Type Amount Date
Figure 4.6: Example Payment Record and Payment Table
This Payment Record captures the payment made by Julia to the business. This is an
example of a relationship that may exist between records and tables. This is Julia’s
payment. The record of Julia’s payment should naturally be associated with Julia’s
customer record, otherwise how will the business know who paid what?
Task A:
Watch the video tutorial on Defining table relationships at the link below.
Allardice, S. (2013). Database programming tutorial: Defining table
relationships. Lynda.com [Video file]. Retrieved from:
Optional Task C:
For information on a formal Table design process watch the video tutorial
on Entity Relationship Diagrams (ERD).
Baldazzi, G. (2013). Entity Relationship Diagram (ERD) Training Video.
Retrieved from:
Order
OrderID OrderDate
Again, we have a one-to-many as one customer can place many orders. Two customers
cannot place the same order. Though the order may contain the same products each
order is clearly uniquely identified by an OrderID. Since one customer can place many
orders we can accommodate this relationship by again adding a new column to the
many side of the relationship (the Order table). We can indicate that it is a one to
many by annotating our diagram with the characters, 1 and M. Note that this is an
extremely simple way of depicting such relationships. What we are representing with
this annotation is referred to as the cardinality of the relationship.
Customer
CustomerID FirstName LastName
79019 Julia Hanson
81234 Fred Doe
91234 Zoe Zee
Order
OrderID OrderDate CustomerID
012 09/01/2016 81234
123 22/02/2016 79019
245 26/02/2016 81234
567 14/03/2016 91234
Fred has placed two orders, with OrderID of 012 and OrderID of 245.
Knowledge Check
What is the nature of the relationship between the Order entity and the
Product entity? Is it a one-to-one relationship, a one-to-many relationship or
a many-to-many relationship? Feel free to consider real world examples to
help you figure out the answer.
A given order may contain one product. For example a customer, Julia, may
order ABC Brand 8.5 X 11 Inch Printer Paper. One given order may contain
many products. Julia may order both a ream of ABC Brand 8.5 X 11 Inch
Printer Paper AND a Cartridge of black ink for her Printer.
Many different orders may contain the same product. For example customers
Julia, Fred and Zoe may each place orders for a ream of ABC Brand 8.5 X 11
Inch Printer Paper. This is a situation involving many orders containing one
specific product.
For example:
Julia may have placed an order for a ream of ABC Brand 8.5 X 11 Inch Printer
Paper AND a Cartridge of black ink for her Printer.
Fred may have placed an order for a ream of ABC Brand 8.5 X 11 Inch Printer
Paper, a Cartridge of black ink for his Printer AND a headset for his computer.
Zoe may have placed an order for a computer Monitor, a Textbook on MIS
Cases and a desk lamp.
Customer Product
CustomerID FirstName LastName ProductID Name Price
79019 Julia Hanson 1 ABC Brand 8.5 $35.99
81234 Fred Doe X 11 Inch Printer
91234 Zoe Zee Paper
2 Cartridge of black $120.00
ink
3 Computer Head- $100.25
Order
set
OrderID OrderDate CustomerID
4 Computer Moni- $500.12
012 09/01/2016 81234
tor
123 22/02/2016 79019
5 Textbook on MIS $10.99
245 26/02/2016 81234
Cases
567 14/03/2016 91234
6 Desk lamp $44.23
To accommodate a many-to-many relationship between the Order table and the Product
table we create another table. Typically, the name of this table will be a combination
of the names of the tables that possess the many-to-many relationship; in this case we
will call the new table OrderProduct. Though this table MUST include a number of
fields/columns it MUST contain the Primary key of both tables.
In this new table you can choose to have a compound key as the primary key. A
compound key is a key that consists of two or more keys combined; collectively this
combination uniquely identifies a record. Alternatively you could create another
column called OrderProductID and assign that to be the primary key.
Based on the example provided above what items did Zoe order?
Customer UserAccount
CustomerID FirstName LastName UserAccountID UsernameName Password
79019 Julia Hanson 1 Superj Password
81234 Fred Doe 2 FredD Pass1234
91234 Zoe Zee 3 Zz ZZ1234
To associate a customer within our design we again need a reference to the Customer.
Since the Customer is the main Entity we are interested in, referred to as the Parent,
the typical approach would be to create another column within the UserAccount table
to store the primary key of the more important Entity. In this case the UserAccount is
referred to as the Child. A rule of thumb is that the child is the entity that cannot exist
without the Parent. In this example we can assume that without a Customer there can
be no UserAccount. This new column added to the UserAccount table will allow us to
record the Customer who owns this UserAccount. As such, it must contain the unique
ID of the customer, the CustomerID.
ACTIVITY 4.6
Table Design (15 minutes)
Instructions:
Revisit the Database Tutorial section of your course text (see below):
Miller, Lisa. (2008). MIS Cases: Decision making with application software
(3rd. Edition). Pearson Education Inc., Upper Saddle River, New Jersey
Review the tutorial introduction, background and scenario (Timeka’s
Tanning Salon Inc) from Learning Activity 4.2 (pages 248-249).
Once you have reviewed these sections, consider the table relationships
required for the scenario. When you are ready go to the Storage
Specification section of the tutorial (pages 250) and read the discussion
provided by the author detailing the required relationships and how they
will be implemented.
In Session 4.2 we explored examples of related business data, the concept of cardinality
and relationship types and learnt how to model such situations within a table design.
In the next session, we will begin to apply the concepts and practices discussed so far
within this unit and build a database using Microsoft Access.
Introduction
Now that you are familiar with database concepts, terminology and good database
design practices it is time to examine how such may be applied in the real world.
In this session you will learn to simulate real world data and business situations in
database models by using Databases to create and edit tables and relationships. This
session will first quickly recap some of the important topics from Session 1 and 2. It will
then introduce you to the Microsoft Access Interface and give you the opportunity to
review a case study and examine how the author of the study has applied the concepts
and practices to satisfy a business need. Your review of the author’s narrative should
reinforce in your mind the concepts discussed and hopefully assist you in integrating
and applying this knowledge in future exercises. Completing the case study will
enable you to develop your skill in using the Microsoft Access software.
Knowledge Check
Based on the video, what are the six parts of a Microsoft Access Database?
Note: These parts may also be referred to as the Microsoft Access Database
objects.
Knowledge Check
Which Access Database object allows you to build a user friendly interface
to add records to a table and view and change records found within an
Access Table?
Forms
ACTIVITY 4.8
Planning Your Database (14 minutes)
Instructions:
Task A: Using the links provided to the video tutorial for your version
of the Microsoft Access software, review the video tutorial to recap some
of the important considerations when planning and designing an Access
Database.
Knowledge Check
Based on your recollection of database design discussion from Session
1 and the video provided in Learning Activity 4.8, list the first that you
should do when designing and planning a database?
ACTIVITY 4.9
The Access Interface (10 minutes)
Instructions:
Task A:
Using the links provided for your version of the Microsoft Access software,
watch the video introducing you to the Access Database Interface to
familiarise yourself with the environment.
Now that you are familiar with the Microsoft Access Database let us practise what we
have learnt by attempting to build a basic database in Learning Activity 4.10.
Task A:
Proceed to the Database Tutorial section of your course text (see below):
Miller, Lisa. (2008). MIS Cases: Decision making with application software
(3 rd. Edition). Pearson Education Inc., Upper Saddle River, New Jersey
Read the Timeka’s Tanning Solon, Inc. case study (pg. 248-255) and
complete Activity 1 of the Database Tutorial (pg. 255-265) using Microsoft
Access.
The steps have been provided for you within the Database Tutorial (pg.
255-265).
(Optional) Task B:
Complete Activity 2 of the Database Tutorial (pg. 265-278).
In Session 4.3 we examined a case study and performed the steps needed to develop a
relational database in response to the stated business problems and business needs of
the fictitious company depicted within the case study. Though this session provided
just a basic introduction to developing Microsoft Access databases, the exercise would
have shown you the practical application of the concepts and practices discussed
in Session 1 and 2. Collectively the knowledge and skill developed in this unit will
support the future application of database concepts and practices in designing and
developing more complex and robust Database solutions involving other Microsoft
Access objects including Forms, Queries and Reports.
In this unit we were exposed to a number of Database concepts, terms, design and
development practices and we had the opportunity to design, create and use Database
solutions to solve business problems or satisfy a business need. Being able to effectively
design tables and manage table relationships is an important skill when attempting
to accurately model real world data within a computer system. This foundation
knowledge should enable you to design and build effective Database solutions that
will be able to produce the information needed to support operational, tactical and
strategic decisions. In the upcoming unit you will review and expand upon table and
relationship design, development and configuration and will be shown how to add
and edit database records.
Miller, Lisa. (2008). MIS Cases: Decision making with application software (3rd
Edition). Pearson Education Inc., Upper Saddle River, New Jersey