0% found this document useful (0 votes)
31 views95 pages

Chap 4 AIS 44

1) A relational database stores data in tables with rows and columns where each row represents a record and each column represents a field. 2) Primary keys uniquely identify each record in a table while foreign keys link records between tables. 3) Relational databases allow for flexible querying of data relationships and integration of data from multiple sources.

Uploaded by

yared mulatu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views95 pages

Chap 4 AIS 44

1) A relational database stores data in tables with rows and columns where each row represents a record and each column represents a field. 2) Primary keys uniquely identify each record in a table while foreign keys link records between tables. 3) Relational databases allow for flexible querying of data relationships and integration of data from multiple sources.

Uploaded by

yared mulatu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 95

CHAPTER 4

Relational Databases

1
INTRODUCTION
• Relational databases underlie most
modern integrated AISs.
– They are the most popular type of database
used for transaction processing.
– In this chapter, we’ll define the concept of a
database first.

2
FILE VS. DATABASES
• Let’s examine some basic principles about
how data are stored in computer systems.
– An entity is anything about which the organization
wishes to store data. At your college or university,
one entity would be the student.
– Information about the attributes of an entity (e.g.,
the student’s ID number and birth date) are stored
in fields.
– All the fields containing data about one entity (e.g.,
one student) form a record.
– A set of all related records forms a file (e.g., the
student file). 3
FILE VS. DATABASES
– A set of interrelated, centrally coordinated
files forms a database.

Student Class
File File

Advisor
File
4
Cont…
• The Database Concept

Database • A database is a set of


Fact A Fact B
Fact C Fact D inter-related, centrally
Fact E Fact F
coordinated files.

Database
Management
System

Enrollment Financial Aid Grades


Program Program Program

5
Cont…
• The database approach treats data as an
organizational resource that should be used by
and managed for the entire organization, not
just a particular department.
• A database management system (DBMS)
serves as the interface between the database
and the various application programs.

6
Cont…
• The combination of the database, the DBMS,
and the application programs that access the
database is referred to as the database
system.
• The person responsible for the database is the
database administrator.

7
IMPORTANCE OF DATABASE SYSTEMS
• Database technology is everywhere.
– Most new AISs implement a database approach.
– Virtually all mainframe computer sites use
database technology.
– Use of databases with PCs is growing also.

8
IMPORTANCE OF DATABASE SYSTEMS
• As accountants, you are likely to audit or work for
companies that use database technology to store,
process, and report accounting transactions.
– Many accountants work directly with databases and will
enter, process, and query databases.
– Some will develop and evaluate internal controls necessary
to ensure database integrity.
– Others will be involved in the design and management of
databases.

9
ADVANTAGES OF DATABASE SYSTEMS
• Database technology provides the following
benefits to organizations:
– Data integration: Achieved by combining master files
into larger pools of data accessible by many programs.
– Data sharing: It’s easier to share data that’s
integrated
– Reporting flexibility: Reports can be revised easily
and generated as needed.
– Minimal data redundancy and inconsistencies:
Because data items are usually stored only once.
10
ADVANTAGES OF DATABASE SYSTEMS
– Data independence: Data items are independent of the
programs that use them. Consequently, a data item can
be changed without changing the program and vice
versa. Makes programming easier and simplifies data
management.
– Central management of data: Data management is
more efficient because the database administrator
is responsible for coordinating, controlling, and
managing data.
– Cross-functional analysis: Relationships can be
explicitly defined and used in the preparation of
management reports. EXAMPLE: Relationship between
selling costs and promotional campaigns. 11
RELATIONAL DATABASES
• Most new DBMSs are called relational
databases because they use the relational
data model developed by E. F. Codd in 1970.
• 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 forms of tables (also known as, relations).

12
Cont…
• In a Relational Table
– Each row, a tuple, contains multiple attributes
describing an instance of the entity.
• This is equivalent to a record
– Each column contains data about one
attribute of an entity.
• This is equivalent to a field

13
STUDENTS
Last First Phone
Each row is
Student ID Name Name No. called a tuple.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

14
STUDENTS Each row
Last First Phone contains data
Student ID Name Name No. about a specific
333-33-3333 Simpson Alice 333-3333 occurrence of
111-11-1111 Sanders Ned 444-4444
the type of
123-45-6789 Moore Artie 555-5555
entity in the
table.

15
STUDENTS Each column in
Last First Phone
Student ID Name Name No.
a table contains
333-33-3333 Simpson Alice 333-3333 information
111-11-1111 Sanders Ned 444-4444 about a specific
123-45-6789 Moore Artie 555-5555 attribute of the
entity.

16
Attributes
• Primary Key
– An attribute or combination of attributes that can be
used to uniquely identify a specific row (record) in a
table.
– For example, Student ID in the students table &
Item Number in the inventory table.
• Foreign Key
– An attribute in one table that is a primary key in
another table.
• Used to link the two tables
17
STUDENTS
Last First Phone
Student ID Name Name No.
333-33-3333 Simpson Alice 333-3333
111-11-1111 Sanders Ned 444-4444
123-45-6789 Moore Artie 555-5555

A primary key is the attribute or combination of


attributes that uniquely identifies a specific row
in a table.
18
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503

ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203

A foreign key is an attribute in one table that is a


primary key in another table.
19
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503

ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203

Foreign keys are used to link tables


together.
20
STUDENTS
First Advisor
Student ID Last Name Name Phone No. No.
333-33-3333 Simpson Alice 333-3333 1418
111-11-1111 Sanders Ned 444-4444 1418
123-45-6789 Moore Artie 555-5555 1503

ADVISORS
Advisor No. Last Name First Name Office No.
1418 Howard Glen 420
1419 Melton Amy 316
1503 Zhang Xi 202
1506 Radowski J.D. 203

Other non-key attributes in each table store


important information about the entity.
21
Basic requirements of a relational database

• Every column in a row must be single valued.


– In other words, every cell can have one and only one
value.
– In the student table, you couldn’t have an attribute
named “Phone Number” if a student could have
multiple phone numbers.
– There might be an attribute named “local phone
number” and an attribute named “permanent phone
number.”
– You could not have an attribute named “Class” in the
student table, because a student could take multiple
classes.
22
Basic requirements of a relational
database
• The primary key cannot be null.
– The primary key uniquely identifies a specific row in the table, so it
cannot be null, and it must be unique for every record.
– This rule is referred to as the entity integrity rule.
• A foreign key must correspond to the value of a primary
key in another table.
– This rule is referred to as the referential integrity rule.
– The rule is necessary because foreign keys are used to link rows in one
table to rows in another table.
• All non-key attributes in a table should describe a
characteristic of the object identified by the primary key.
23
Data Base Design Process

24
Cont…
• Accountants may provide the greatest value by taking
responsibility for data modeling—the process of defining
a database to faithfully represent all aspects of the
organization, including interactions with the external
environment.
– Occurs during both system analysis and conceptual
design stage.
– Two important tools to facilitate data modeling:
• Entity-relationship diagramming
• REA data model

25
ENTITY-RELATIONSHIP DIAGRAMS
• An entity-relationship (E-R) diagram is a
graphical technique for portraying
(depicting) a database schema (DB Design
in picture).
– Shows the various entities being modeled and
the important relationships among them.

26
Cont…
• An entity is anything about which the
organization wants to collect and store
information.
– Example: Your university collects and stores
information about students, courses, enrollment
activity, etc.
• In a relational database, separate tables
would be created to store information
about each distinct entity.
27
Cont…
• In an E-R diagram, entities are depicted as
rectangles.
• But there are no industry standards for other
aspects of these diagrams.

Enrollment Students

28
Cont…
• Some data modelers, tools, and authors use
diamonds to depict relationships.

Line
Enrollment Items Students

29
Cont…
• Others do not use diamonds.

Enrollment Students

30
Cont…
• Sometimes the attributes associated with each
entity are depicted as named ovals connected to
each rectangle.
Student
Enrollment Student Name
Number Enrollment ID No.
Date
Student
Address
Enrollment
Time

Enrollment Students

31
Cont…
• Sometimes these attributes are listed in a
separate table.

Enrollment Students

Entity Name Attributes


Enrollment Enrollment No., Enrollment Date, Enrollment Time
Student Student ID No., Student Name, Student Address
32
Cont…
• E-R diagrams can be used to represent the
contents of any kind of databases.
• Our focus is on databases designed to
support an organization’s business
activities.
• The diagrams we develop depict the
contents of a database and graphically
model those business processes.
33
Cont..
• In addition to their use in designing
databases, E-R diagrams can be used to:
– Document and understand existing databases.
– Reengineer business processes.
• In this chapter, we’ll use E-R diagrams for
designing new databases and
understanding existing ones.

34
Cont…
• E-R diagrams can include many different
kinds of entities and relationships.
• An important step in designing a
database is deciding which entities need
to be modeled.
• The REA data model is useful for this
decision.

35
THE REA DATA MODEL
• The REA data model was developed
specifically for use in designing accounting
information systems.
– Focuses on business semantics underlying an
organization’s value chain activities.
– Provides guidance for:
• Identifying the entities to be included in a
database.
• Structuring the relationships among the
entities.

36
Cont…
• REA data models are usually depicted in
the form of E-R diagrams.

• Therefore, we refer to E-R diagrams


developed with the REA model as REA
diagrams.

37
Cont…
• Three basic types of entities
– The REA data model is so named because it classifies
entities into three distinct categories:
• Resources that the organization acquires and uses.
Resources are things that have economic value to the
organization.
• Events in which the organization engages. These are the
various business activities about which management wants
to collect information for planning or control purposes.
• Agents participating in these events. Includes people and
organizations who participate in events and about whom
information is desired for planning, control, and evaluation
purposes.
38
Cont…
• Can you identify the resources in this diagram?
• Can you identify the events in this diagram?
• Can you identify the agents in this diagram?
Inventory Sales Employee

Customer

Cash Receive
Employee
Accounts Cash
39
Cont…
• Structuring relationships: The basic REA
template
– The REA data model prescribes a basic
pattern for how the three types of entities
(resources, events, and agents) should
relate to one another.

40
Cont…
• Rule 1: Each event is linked to at least one resource
that it affects.

Resource A Event A

Resource B Event B
41
Cont…
• Rule 2: Each event is linked to at least one other
event.

Resource A Event A

Resource B Event B
42
Cont…
• Rule 3: Each event is linked to at least two
agents.

Resource A Event A Agent A

Agent B

Resource B Event B Agent C


43
Developing an REA Diagram for a Specific
Transaction Cycle
• It consists of three steps:
– STEP ONE: Identify the events about which
management wants to collect information.
– STEP TWO: Identify the resources affected by
the events and the agents who participated.
– STEP THREE: Determine the cardinalities
between the relationships.
• Let’s walk through an example.

44
STEP ONE: IDENTIFY RELEVANT EVENTS
• At a minimum, every REA model must include the
two events that represent the basic “give-to-get”
economic exchange performed in that transaction
cycle.
• The give event reduces one of the organization’s
resources.
• The get event increases a resource.
• There are usually other events that management is
interested in planning, controlling, and monitoring.
These should be included in the model.
45
Cont…

• Example: Typical activities in the revenue cycle


include:
– Take customer order: Taking the customer order does
not involve giving or taking a resource. It is a
commitment event.
– Fill customer order: Filling the order involves a reduction
in the company’s inventory. It is a give event.
– Bill customer: Billing customers involves the exchange of
information with an external party but does not affect
resources.
– Collect collection: Collecting collection results in an
increase in cash. It is a get event.
46
Cont…
• The give-to-get, then, is:
– Fill customer order (often referred to as “sale”);
– Collect cash (often referred to as “cash receipt”).
• Should “take customer order” and “bill
customer” be included in the model?

47
Cont…
Take customer order Bill customer
• Taking an order requires • Printing and mailing invoices
that we set resources aside. does not directly affect an
• That information should be economic resource.
• It does not represent a
included in our model.
commitment on the part of the
company to a future exchange.
• It is an information retrieval
event and should not alter the
contents of the database.
• Does not need to be included
in the model.

48
Cont…
• In completing the first step of an REA diagram,
the event entities are typically drawn from top
to bottom in the sequence in which they
normally occur.

49
Cont…

Take Order

Sale

Receive
Cash
50
STEP TWO: IDENTIFY RESOURCES AND
AGENTS
• When the relevant events have been
diagrammed in the center of the REA diagram,
the resources that are affected by those
events need to be identified.
• Involves determining:
– The resource(s) reduced by the give event.
– The resource(s) increased by the get event.
– The resources that are affected by a commitment
event.
51
Cont…
• In order to identify the resources that are affected by the
relevant events identified above the following questions may be
raised:
– What is the give event?
 Sale
– What resource is reduced by the give event?
 Inventory
– What is the get event?
 Receive Cash
– What resource is increased by the get event?
 Cash
– Is there a commitment event?
 Take Order
– What resource is affected by the commitment event?
 Inventory 52
Cont…

Take Order

Inventory

Sale

Receive
Cash
Cash
53
Cont…
• The agents who participate in each event
should also be identified.
– There will always be at least one internal agent
(employee).
– In most cases, there will also be an external
agent (e.g., customer or supplier) who
participates.

54
Cont…
• In order to identify the agents who participate
in each event identified above the following
questions may be raised:
– What agents are involved in the sale?
 Employee and Customer
– What agents are involved in the receipt of cash?
 Employee and Customer
– What agents are involved in taking the order?
 Employee and Customer

55
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
56
STEP THREE: DETERMINE CARDINALITIES
OF RELATIONSHIPS
• The final step in an REA diagram for a transaction cycle is
to add information about the relationship cardinalities.
• A cardinality describes the nature of the relationship
between two entities.
– It indicates how many instances of one entity can be linked
to a specific instance of another entity.
– For example, the cardinality between the event Sales and
the agent Customer answers the question:
• For each sale a company makes, how many customers
are associated with that sale?

57
Cont…
• Unfortunately, there is no universal standard
for diagramming cardinalities.
• In this chapter, we adopt the graphical “crow’s
feet” notation style because:
– It is becoming increasingly popular.
– It is used by many software design tools.

58
Cont…
• Using the crow’s feet notation:
– The symbol for zero is a circle: O
– The symbol for one is a single stroke: |
– The symbol for many is the crow’s foot:

59
Cont…
• There is typically a minimum and maximum
cardinality for each entity participating in a
relationship.
– The minimum cardinality can be either zero or
one.
– The maximum cardinality can be either one or
N (many).

60
Cont…
• Three types of relationships
– Three types of relationships are possible
between entities.
– Relationships depend on the maximum
cardinality on each side of a relationship.

61
Cont…
• A one-to-one relationship (1:1) exists when the maximum cardinality for each
entity in the relationship is one.

Take Order

• Both maximums are


one, so this is a one-
to-one relationship.

Sale

62
Cont…
• A one-to-many (1:N) relationship exists when the maximum cardinality
on one side is one and the maximum on the other side is many.

Sale Customer

• The maximum number of customers that can be involved in each


sale is one.
• The maximum number of sales that can be associated with any
individual customer is many.
• This is a one-to-many (1:N) relationship.

63
Cont…
• A many-to-many (M:N) relationship exists when the maximum on both
sides is many.

Inventory Sale

• The maximum number of inventory items that can be sold in one


sale is many.
• The maximum number of sales that can occur for a particular
inventory item is many.
• This is a many-to-many (M:N) relationship.

64
Cont…
• It is not a “one size fits all” world for
relationships and cardinalities. The
cardinalities between two entities can vary
based on how the particular company does
business.
• Let’s look at some examples.

65
Cont…
• Customers pay for
Sale each sale with a
maximum of one
payment (typical for
retail stores).
• Each cash receipt
from a customer
relates to one (and
Cash only one) sale.
• The relationship
Receipt
between sales and
cash receipts is
1:1.

66
Cont…
• Customers pay for
Sale each sale with a
maximum of many
payments
(installments).
• Each cash receipt
from a customer
relates to one (and
Cash only one) sale.
• The relationship
Receipt
between sales and
cash receipts is
1:N.

67
Cont…
• Customers make
Sale only one payment
for a sale.
• Each cash receipt
from a customer
can relate to
multiple sales (e.g.,
they pay for all
Cash sales that month in
one payment).
Receipt
• The relationship
between sales and
cash receipts is
1:N.

68
Cont…
• Customers may
Sale make multiple
payments for a
particular sale.
• A cash receipt from
a customer may
relate to more than
one sale.
Cash • The relationship
Receipt between sales and
cash receipts is
M:N.

69
Cont…

• In other words, the choice of cardinalities is


not arbitrary.
• It reflects facts about the organization that are
obtained during the requirements definition
stage of the database design process.

70
Cont…
• Now let’s go back to the REA diagram for the
revenue cycle and see if we can complete the
cardinalities.

71
Cont…
• In relationships between events and agents:
– For each event that occurs, the cardinality
between event and agent is typically (1:1).
– Example: When a sale occurs:
• There is usually one and only one customer.
• There is usually one and only one salesperson.
This practice makes it more feasible for the
organization to establish employee
accountability for the event.

72
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
73
Cont…
• For each agent the cardinality between agent
and event is typically (0:N).
– Example: For a particular salesperson:
• There is typically a minimum of zero sales (allows for
inclusion of a new salesperson who has not yet made
any sales).
• A salesperson can have a maximum of many sales.
– Or: For a particular customer:
• There is typically a minimum of zero sales (to allow for
the inclusion of prospective customers who haven’t
bought anything yet) and a maximum of many sales.
74
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
75
Cont…
• Let’s now look at the relationship between
events and resources.
– In the cardinality between event and resource,
the minimum cardinality is typically one, because
an event can’t occur without affecting at least
one resource.

76
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
77
Cont…
• The maximum could be one or many.
– In this particular story, each sale can involve
many items of inventory, so the maximum is
many.
– However, every receipt of cash is deposited to
one and only one cash account, so the
maximum there is one.

78
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
79
Cont…
• In the cardinality between resource and
event, the minimum is typically zero.
– A company can have an inventory item for
which there has never been a sale.
– When the company’s cash account is new,
there has never been a cash receipt deposited
in it.

80
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
81
Cont…
• In the cardinality between resource and
event, the maximum is typically many.
– Most inventory items can be sold many times. (An
exception might occur if each inventory item is
one unique item, such as a piece of real estate.)
– The company’s cash account can have many cash
receipts.

82
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
83
Cont…
• Finally, let’s look at the relationships between events.
• When events occur in a sequence, the minimum
cardinality between the first event and the second
event is always zero, because there is a span of time
(although possibly quite short) when the first event has
occurred but there are zero occurrences of the second
event.
• Examples:
– When an order is first taken, there have been no
deliveries of goods (sale event) to the customer.
– When goods are delivered to the customer, there is a
span of time, however brief, in which there is no cash
receipt from the customer.
84
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
85
Cont..
• The minimum cardinality between the second
event and the first event is typically one,
because the second event can’t occur without
the first event having occurred.

86
Cont…

Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
87
Cont…
• The maximums in the cardinalities between
events can be either one or many, and these
maximums vary based on business practices.
• We saw this when we looked at the four
different possibilities for the relationships
between sales and cash receipts previously.
• On the following slides, see if you can explain
the maximums between the three events.

88
Cont…

• Revenue Cycle REA Diagram


Take Order Employee

Inventory
Customer

Sale

Employee

Receive
Cash Customer
Cash
89
Cont…
• Uniqueness of REA diagrams
– Each organization will have its own unique REA
diagram.
• Business practices differ across companies, so
cardinalities and relationships will differ.
• A given organization can change business practices,
leading to a change in its REA diagram:
– A change in practice could cause a change in
cardinalities.
– Could even lead to the inclusion of different entities
on the diagram.
90
Cont…
• Data modeling can be complex and repetitive.
– Data modelers must discuss their drafts of models
with intended users to ensure that:
• Key dimensions are not omitted or misunderstood.
• Terminology is consistent.

91
DATABASE SYSTEMS AND THE FUTURE OF
ACCOUNTING
• Database systems may profoundly affect the
fundamental nature of accounting:
– May lead to abandonment of double-entry
accounting, because the redundancy of the
double entry is not necessary in computer data
processing.
– May also alter the nature of external reporting.
• EXAMPLE: External users could have access to the
company’s database and manipulate the data to meet
their own reporting needs.

92
Cont…
• The use of accounting information in decision
making will be enhanced by:
– Powerful querying capabilities that accompany
database packages.
– The ability to accommodate multiple views of the
same underlying phenomenon.
– The ability to integrate financial and operational
data.

93
Cont…
• Accountants must become knowledgeable
about databases so they can participate in
developing the AIS of the future.
• They must help ensure that adequate controls
are included to safeguard the data and assure
its reliability.

94
The End!

95

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy