You are on page 1of 13

CHAPTER 4

RELATIONAL DATABASES
Instructors Manual
Learning Objectives:
1. Explain the importance and advantages of databases, as well as the
difference between database and file-based legacy systems.
2. Explain the difference between logical and physical views of a
database
3. Explain fundamental concepts of database systems such as DBMS,
schemas, the data dictionary, and DBMS languages
4. Describe what a relational database is and how it organizes data
5. Create a set of well-structured tables to properly store data in a
relational database
6. Perform simple queries using the Microsoft Access database
Note to Instructor: Objective 6 will require students to use the
following publishers website: http://www.prenhall.com/romney which will
be explained in more detail.
Questions to be addressed in this chapter:

How are databases different than file-based legacy systems?


Why are databases important and what is their advantage?
What is the difference between logical and physical views of a
database?
What are the fundamental concepts of database systems such as
DBMS, schemas, the data dictionary, and DBMS languages?
What is a relational database, and how does it organize data?
How are tables structured to properly store data in a relational
database?

Introduction
The emphasis in this chapter will be on understanding the structure of a
relational database system.
Files versus Databases
A file as described in the back of our book in the glossary is a
set of logically related records, such as the payroll records of
all employees.
Figure 4-1 on Page 104 shows the basic elements of data hierarchy.
Fields contain data about one customer such as the customers
address, customer name, etc.

Page 1 of 13

All the fields for one customer form a record.


A set of related records, such as all customer records forms
a file.
A set of interrelated files forms a database.
We use the term data base to mean the collected data sets that are
organized and stored as an integral part of a firms computerbased information system.
In turn, we define the term data sets as flexible data
structures. Data sets include groupings of data that are
logically related as well as the files with which we are
familiar
Figure 4-2 on Page 107 provides a comparison of file-oriented
versus database systems
Most firms developing new systems and applications for use in
todays business environment choose the data-base approach to data
management.
Data independence, a critical feature of the data-base approach,
is the separation of data from the various applications that
access and process the data.
Data independence is achieved by interposing the data-base
management system (DBMS) software between the data base and the
users of the data(e.g., the application programs.
A database management system (DBMS) acts as an interface between
the database and the various application programs.
As technology improves many companies are developing very large
databases called data warehouses.
Data mining is the process of analyzing data repositories for new
knowledge about the companys data and business processes; as
discussed in greater detail in chapter 14.
Multiple Choice 1
A customers name would be a:
a.
b.
c.
d.

Database
File
Field
Record

Multiple Choice 2

Page 2 of 13

Which of the below would is a file?


a.
b.
c.
d.

A customers name
Data about one customer
All inventory records
Data about one inventory item

Learning Objective One


Explain the importance and advantages of databases,
as well as the difference between database and
file-based legacy systems.

The Importance and Advantages of Database Systems


Note to Students: Some of the job announcements for accounting
positions require the knowledge and skills from experience in
using MS Access.
Most accounting students will audit or work for a company that
uses database technology to store, process and report accounting
transactions.
Database technology is widespread because it provides
organizations with the following benefits:

Data integration: Integration is achieved by combining


master files into larger pools of data that many
application programs can access. An example is an employee
database that consolidates data formerly contained in
payroll, personnel, and job skills master files. This makes
it easier for information to be combined in unlimited ways

Data sharing: Integrating data makes it easier to share data


with all authorized users.

Reporting flexibility: Reports can be revised easily and


generated as needed and the database can be easily browsed
to research a problem or obtain detailed information
underlying a summary report

Minimal data redundancy and data inconsistencies: Because


data items are usually stored only once, data redundancy and
data inconsistencies are minimized

Data independence: Because data and the programs that use


them are independent of each other, each can be changed
without having to change the other. This makes programming
easier and simplifies data management

Central management of data: Data management is more


efficient because a database administrator is responsible

Page 3 of 13

for coordinating, controlling and managing data

Cross-functional analysis:
relationships, such as the
and promotional campaigns,
used in the preparation of

In a database system,
association between selling costs
can be explicitly defined and
management reports.

Note to the Instructor: The additional benefit could be added that


is not mentioned in the book:
One-time Data Entry and Storage: In the data-base approach to
data management data are input into the data base once, stored
in a particular location and available for use my multiple
applications and users.
Multiple Choice 3
The database technology benefit that makes it easier for
information to be combined in unlimited ways is:
a.
b.
c.
d.

Data sharing
Data independence
Central management of data
Data integration

Learning Objective Two


Explain the difference between logical and
physical views of a database

Database Systems
Logical and Physical Views of Data
Figure 4-3 at the bottom of Page 107 provides an example of a
record layout of an accounts receivable file.
The logical view is how the user or programmer conceptually
organizes and understands the data.
The physical view refers to how and where the data are physically
arranged and stored in the computer system.
Figure 4-4 on Page 109 provides multiple logical views of data
As shown in Figure 4-4, database management system (DBMS)software
handles the link between the way data are physically stored and
each users logical view of the data.
Multiple Choice 4
Page 4 of 13

The data view that shows how the user or programmer


conceptually organizes and understands the data is the
a.
b.
c.
d.

Record layout view


Logical view
Physical view
None of the above

Learning Objective Three


Explain fundamental concepts of database
systems such as DBMS, schemas, the data
dictionary and DBMS languages

Schemas
A schema describes the logical structure of a database.
Three levels of schemas: the conceptual, the external and
the internal.
Figure 4-5 on Page 108 provides the three levels of schemas
The conceptual-level schema is the organization-wide view of
the entire data-base.
The external-level schema consists of a set of individual
user views of portions of the database, each of which is
also referred to as a subschema.
The internal-level schema provides a low-level view of the
database. It describes how the data are actually stored and
accessed, including information about record layouts,
definitions, addresses and indexes.
The Data Dictionary
The data dictionary contains information about the structure
of the database. The data elements composing the data base
are fully described in a data dictionary, which serves as a
repository containing facts about the structure of the data
elements employed in applications.
Table 4-1 on Page 110 provides an example of a data
dictionary.

Database Management System (DBMS) Languages

Page 5 of 13

The data definition language (DDL) is used to (1) build the


data dictionary, (2) initialize or create the database, (3)
describe the logical views for each individual user or
programmer, and (4) specify any limitations or constraints
on security imposed on database records or fields.
The data manipulation language (DML) is used for data
maintenance, which includes such operations as updating,
inserting, and deleting portions of the database.
The data query language (DQL) is used to interrogate the
database. The DQL retrieves, sorts, orders and presents
subsets of the database in response to user queries.
A report writer is a language that simplifies report
creation.
Note to the Instructor: The additional definition and
additional uses that was not included in the book could be
provided to the students:
A data-base control system (DBCS) that controls the various
components of the DBMS. For example, the DBCS creates and
manages the structure used for storing the data. It also
creates the necessary support components that allow
simultaneous multiple-user access to the data.
In addition to the functions provided by these components,
many DBMS packages allow users to
(1) analyze data and create ad hoc or customized
reports,
(2) create and display graphs,
(3) create customized applications via host
programming languages,
(4) import and export data and images from other
packages,
(5) perform on-line data editing,
(6) purge or archive obsolete data,
(7) back up data,
(8) maintain other security measures, and
(9) interface with communications networks

Multiple Choice 5

Page 6 of 13

Which of the following statements are false?


a. The data dictionary contains information about the
structure of the database.
b. The internal-level schema provides a high-level view
of the database.
c. The data definition language is used to build the data
dictionary.
d. The conceptual-level schema is the organization-wide
view of the entire data-base.
Multiple Choice 6
There should be limited access to employees with
administrative and programming responsibilities to
a.
b.
c.
d.
e.

DML
DQL
DDL
A and C
All of the above

Learning Objective Four


Describe what a relational database I and
how it organizes data.

Relational Databases
A data model is an abstract representation of the contents
of a database.
The relational data model represents everything in the
database as being stored in the form of tables like the one
shown in Table 4-2 on Page 111.
Technically, these tables are called relations (hence the
name relational data model), but we will use the two words
interchangeably.
Each row in a relation, called a tuple (which rhymes with
couple), contains data about a specific occurrence of the
type of entity represented by that table. For example, each
row in the inventory table in Table 4-2 contains data about
a particularly inventory item that S&S carries.

Types of Attributes

Page 7 of 13

A primary key is the attribute, or combination of


attributes, that uniquely identifies a specific row in a
table. The primary key for the inventory table in Table 4-2
is the Item Number.
A foreign key is an attribute in a table that is a primary
key in another table. Foreign keys are used to link tables.
Multiple Choice 7
In a Sales Table, the most likely primary key would be
a.
b.
c.
d.

Sales invoice number


Inventory item number
Customer number
Customer name

Multiple Choice 8
In an inventory table, the most likely nonkey would be
a.
b.
c.
d.
e.

Item number
Color
Price
B and C
A and C

Learning Objective Five


Create a set of well-structured tables to
properly store data in a relational
database.

Designing a Relational Data Base for S&S, Inc.


Option 1: Store All Data in One Uniform Table.
This data is provided in Table 4-3 on Page 115
This approach has two disadvantages:
1) It creates a great deal of redundancy in terms of
stored data. For example, since there are three
separate inventory items sold, the sales invoice
number 102 is listed three times with the invoice
and customer data is repeated each time an items is
sold.

2) The second problem that can occur is referred to as


an insert anomaly, because there is no way to store

Page 8 of 13

information about prospective customers until they


actually make a purchase.
Option 2: Vary the Number of Columns
This data is provided in Table 4-4 on Page 114 & 115
In this option 2, the data storage is to record the sales invoice
and customer information just once.
This required additional items which required five additional
columns:
1)
2)
3)
4)
5)

Item
Quantity
Description
Unit Price
Extended Amount

We still have disadvantages. This approach does not reduce some of


the redundancy and some of the anomalies associated with the data
storage scheme illustrated in Table 4-3.
This table is set up for the sale of five items. What
happens if eight items are sold? This would require 40
columns! Now we are going to have even more columns to add
three more items.
The problems associated with Options 1 and 2 in Tables 4-3 and 4-4
can be solved with a relational database.
Basic Requirements of a Relational Database
1) Every column in a row must be single valued
2) Primary keys cannot be null
3) Foreign keys, it not null, must have values that correspond to
the value of a primary key in another table
4) All nonkey attributes in a table should describe a
characteristic about the object identified by the primary key
A set of Relational Databases are provide in Table 4-5 on Page 116
As shown in Table 4-5 we now have more than one table that have
relationships:
1)
2)
3)
4)

Sales Table
Sales-Inventory Table
Inventory Table
Customer Table

Primary key is the attribute, or combination of attributes, that


uniquely identifies a specific row in a table. As a result, the

Page 9 of 13

value for a primary key cannot be blank (null). If it was blank,


then there would be no way to identify a specific row and retrieve
any data.
The entity integrity rule ensures that every row in every relation
must represent data bout some specific object in the real world.
Foreign keys are used to link rows in one table to rows in another
table. Refer to the lines and arrows in Table 4-5.
The link to each sales transaction with the customer who
participated in that event if the customer number values in
the sales table correspond to actual customer numbers in the
customer table.
This is referred to as the referential integrity rule
that ensures the consistency of the database.
For example, the customer # is a foreign key in the sales
table that relates to the customer # that is a primary key
in the customer table.
Foreign keys can have a null value. Some customers that pay
cash may not want to give up their identity which would be
able to allow a company to track them. Therefore, their will
be some Customer # fields that will be left blank.
Nonkey attributes are items in a table that are neither a primary
key nor a foreign key. As previously described as the 4th basic
requirement for a relational database; all nonkey attributes in a
table should describe a characteristic about the object identified
by the primary key.
Two Approaches to Database Design
One approach is called normalization, which starts with the
assumption that everything is initially stored in one large table.
The details of the normalization process are beyond the
scope of this book but can be found in any database
textbook.
Note to the Instructor: The following website provides more detailed
information regarding normalization:
http://en.wikipedia.org/wiki/Database_normalization . Note that
normalization is also spelled normalization.
Another alternative way to design will-structured relational
databases involves semantic data modeling. Under this approach,
the database designer uses knowledge about how business processes
typically work and about the information needs associated with
transaction processing to draw a graphical picture of what should
be included in the database. The resulting figure can then be
directly used to create a set of relational tables that are in
third normal form (3NF). Refer to the about website for the third
normal form.

Page 10 of 13

Multiple Choice 9
Which of the following is not a basic requirement of a
relational database?
a. Every column in a row must be single valued
b. Primary keys cannot be null
c. Foreign keys must have values that correspond to
the value of another foreign key in another table
d. All nonkey attributes in a table should describe a
characteristic about the object identified by the
primary key.
e. All of the above are basic requirements of a
relational database.

Learning Objective Six


Perform simple queries using the Microsoft
Access database.
Creating Relational Database Queries
Note to Instructor: If students want to follow along with the five
queries and create these queries; they need to first bring up website:
http://www.prenhall.com/romney .
Next, the students need to follow the following five steps:
1. Left click on Companion Website under Accounting Information
Systems 11/e.
2. Click on Chapter 4 from the Chapter List.
3. In the Learning Objectives window, left click on Student
Resources in the menu on the left-hand side of the computer
screen.
4. Under Student Resources. Left click on Case, Journals and
Ledgers.
5. Under Case, Journals and Ledgers, left click on S&S In-Chapter
Database. This will give the student the Customer, Inventory,
Sales and Sales-Inventory to be used for students to follow
along and practice completing the 5 queries for S&S.
The MS Access menu is shown in Table 4-6 on Page 120
Query 1. We are using the Sales and Customer Tables for this Query

Next we select the files from each Table to be included in the


Query. Note the Sales Table Primary Key is Sales Invoice # and the
Foreign Key is the Customer # which is the Primary Key for the
Customer Table.
This is shown in Table 4-7 on Page 119

Page 11 of 13

The Sales and Customer Tables, and the Results of the Query are
shown in Table 4-8 on Page 119
Note to Instructor: Attachment 1 to this Instructor Manual
provides a step-by-step picture screen explanation of how to
complete and run query 1.
Query 2. This query involves the Sales, Sales-Inventory and
Inventory tables. Students should be able now to determine the
Primary Keys and the Foreign Keys involved.
The Completed Query 2 and Query 2 Answer are provided in Table 4-9
on Page 120.
Query 3. Now we are using four tables; Customer, Sales, SalesInventory and Inventory tables.
The Completed Inquiry 3 and Query 3 Answer is provided in Table 410 on Page 123.
Query 4. We will be using the Sales, Sales-Inventory and Inventory
tables.
The Completed Inquiry 4 and Query 4 Answer is provided in Table 411 on Page 122.
Query 5. We will be using the same three tables that were used in
Query 4.
The Completed Inquiry 5 and Query 5 Answer is provided in Table 412 on Page 123.
Multiple Choice 10
What tables were needed in the query that answered the
question: How many televisions were sold in October?
a.
b.
c.
d.
e.

Sales table
Inventory table
Sales-Inventory table
All of the above
A and C

Database Systems and the Future of Accounting


Database systems may profoundly affect the fundamental nature of
accounting. For instance, database systems may lead to the
abandonment of the double-entry accounting model.
If the amounts associated with a transaction are entered into a
database system correctly, then it is necessary to store them only
once, not twice.

Page 12 of 13

Database systems also have the potential to significantly alter


the nature of external reporting.
Why not simply make a copy of the companys financial database and
make it available to external users in lieu of the traditional
financial statements?
Focus 4-1 on Page 125 discusses this possibility in more detail.
Perhaps the most significant effect of database systems will be in
the way accounting information is used in decision making.
Relational databases, however, provide query languages that are
powerful and easy to use.
Managers can concentrate solely on specifying what information
they want.
Finally, relational DBMSs provide the capability of integrating
financial and operational data.

Answer to Multiple Choice Questions:


Multiple Choice Question Answers
Number Answer Number
Answer
1
C
6
D
2
C
7
A
3
D
8
D
4
B
9
C
5
B
10
D
Note to Instructor: Attachment 2 to this instructors manual
provides a picture screen description of the steps used in the MS
Access software to 1) creating a database, 2) creating two tables,
3) adding records to the two tables, 4) creating a query and 5)
running a query. These instructions will be helpful if problems
4.6 through 4.10 are assigned as homework.

Page 13 of 13

You might also like